PDA

View Full Version : Problem with sendmail.php


hatch
04-01-2011, 01:26 PM
Hello. I am very new to Dreamweaver. I took a 3-part series class on Dreamweaver. So far, I have been able to make a webpage and everythign works except sendmail.php.

I am getting the email. I am getting the code with the data though. Here is what the email reads:

<p>Name: Jane Doe<br />
Street: 15 Bridge Rd<br>
City: Wilmington<br>
State: NC<br>
Zip Code: 28411<br>
Telephone: (910) 555-5555<br>
Email Address: janedoe@msn.com<br>
Practice Area: Real Estate<br />
Comments: Testing the contact form.</p>


This is the code. I took it directly from the class example:

//create email
$to = 'info@mycompany.com';
$subject = 'Form Submission';
$message = "<p>Name: ".$name."<br />
Street: ".$address."<br>
City: ".$city."<br>
State: ".$state."<br>
Zip Code: ".$zip."<br>
Telephone: ".$telephone."<br>
Email Address: ".$email."<br>
Practice Area: ".$practice_area."<br />
Comments: ".$comments."</p>";


I would appreciate any help. I have tried to fix it. I have read a lot of post too.

Corrosive
04-01-2011, 01:28 PM
Use 'new line' \n instead of the break tags.

hatch
04-01-2011, 01:43 PM
Thanks for your help. That worked perfectly, so I have another question. I would like to customers email address to show in the "from" and "reply to". I cannot get the email to work unless I put my own email in there. Any suggestions?

$headers = 'From: infor@mycompany.com' . "\r\n" .
'Reply-To: info@mycompany.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

Corrosive
04-01-2011, 01:54 PM
Can you not just feed in the variable?

hatch
04-01-2011, 02:01 PM
Tried this code:

$headers = 'From: '.$email. "\r\n" .
'Reply-To: '.$email. "\r\n" .
'X-Mailer: PHP/' . phpversion();

When I tried it out, I got my "Failed to send message." prompt for a bad send.

Corrosive
04-01-2011, 04:03 PM
Check example 2 here; http://php.net/manual/en/function.mail.php to give you some guidance.

edbr
04-02-2011, 01:04 AM
echo $headers see what you have got