Page 1 of 1

Some help needed

Posted: Sat Jun 27, 2009 4:48 pm
by Reikiii
I have purchased a great template and I have problems to implement the contact form function. The source code is listed below. Any help is much welcomed. Where do I need to make changes? Are there any errors?

Thank you very much!!!

Cindy

<?php

$your_name = $_GET['your_name'];
$your_phone = $_GET['telephone'];
$your_email = $_GET['your_email'];
$your_message = $_GET['message'];




$headers .= 'Content-type: text/html; charset=iso-8859-1';

$content = "<html><head><title>Contact letter</title></head><body><br>";
$content .= "Name: <b>" . $your_name . "</b><br>";
$content .= "Phone: <b>" . $your_phone . "</b><br>";
$content .= "E-mail: <b>" . $your_email . "</b><br><hr><br>";
$content .= $your_message;
$content .= "<br></body></html>";

mail($recipient,$subject,$content,$headers); <br>
$recipient = "info@mywebsite.com";
$subject = "Contact request";
$headers = "From: info@mywebsite.com";

?>
<html>
<body bgcolor="#282E2C">
<div align="center" style="margin-top:60px;color:#FFFFFF;font-size:11px;font-family:Tahoma;font-weight:bold">
Your message was sent. Cindy will contact you shortly. Thank you.
</div>
</body>
</html>
<script>resizeTo(600, 600)</script>



There is another file called 'activescript' as follows:

<%
for i=1 to 7
message=Request("message")
next
message=message + Request("message")
smtpServer = "smtp.1and1.com"
smtpPort = 25


name = Request("Your_Name:")
Set myMail = CreateObject("CDO.Message")
myMail.Subject = "from " & name
myMail.From = Request("Your_Email:")
myMail.To = Request("info@youremail.com")
myMail.HTMLBody = "<html><head><title>Contact letter</title></head><body><br>" & message & "</body></html>"
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/config ... /sendusing") = 2
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/config ... smtpserver") = smtpServer
myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/config ... serverport") = smtpPort
myMail.Configuration.Fields.Update
myMail.Send

%>

Re: Some help needed

Posted: Sun Jun 28, 2009 7:34 am
by Darhazer
It seems that PHP and ASP are mixed in the code above. However for the PHP part:

Code: Select all

mail($recipient,$subject,$content,$headers); <br>
$recipient = "info@mywebsite.com";
$subject = "Contact request";
$headers = "From: info@mywebsite.com";
Should be rewritten as:

Code: Select all

 
$recipient = "info@mywebsite.com";
$subject = "Contact request";
$headers .= "\r\nFrom: info@mywebsite.com";
mail($recipient,$subject,$content,$headers);
 

Re: Some help needed

Posted: Sun Jun 28, 2009 8:14 am
by a94060
Darhazer wrote:It seems that PHP and ASP are mixed in the code above. However for the PHP part:

Code: Select all

mail($recipient,$subject,$content,$headers); <br>
$recipient = "info@mywebsite.com";
$subject = "Contact request";
$headers = "From: info@mywebsite.com";
Should be rewritten as:

Code: Select all

 
$recipient = "info@mywebsite.com";
$subject = "Contact request";
$headers .= "\r\nFrom: info@mywebsite.com";
mail($recipient,$subject,$content,$headers);
 
like Darhazer shows in his code, you are calling the mail function before you are assigning the variables any values. The code posted by Darhazer assigns the variable values first,then mails them (the proper way). Most likely,you are getting blank emails (which must be your problem)

Re: Some help needed

Posted: Sun Jun 28, 2009 5:24 pm
by califdon
With templates as bad as those finding suckers to actually pay for them, I think I'll go into business!

Re: Some help needed

Posted: Fri Jul 03, 2009 8:09 pm
by Reikiii
Thanks so much guys! It worked right away. I totally appreciate your help... Thank you. Cindy.