php mail function

php mail function

Posted by: allenwa
Posted on: 2009-03-16 12:41:00

Hello all! I'm moving a website from my old service provider over to dreamhost. My website calls the php mail function to send an email when a customer submits an order. This function is failing on dreamhost. Is SendMail not installed?

Thanks!

Re: php mail function

Posted by: sdayman
Posted on: 2009-03-16 13:23:00

Sendmail is installed and it's possible to mail via PHP. What's your PHP syntax for sending the message?

-Scott

Re: php mail function

Posted by: allenwa
Posted on: 2009-03-16 15:53:00

Hi Scott, here's my syntax. Again, this worked on my old provider; however I fully realize different versions of PHP, etc work a little differently.

$recipient = "Name <name@domain.com>";
$subject = "Hey, a new order!";
$message = "Check it out, a new order!";
$extra = "From: Webmaster<webmaster@domain.com>\r\nReply-To: webmaster@domain.com\r\n";

mail ($recipient, $subject, $message, $extra);

Re: php mail function

Posted by: sdayman
Posted on: 2009-03-16 17:22:00

Take off the \r\n from the last header (Reply-To). You only need those to separate headers, and there's no header after that, so that creates a blank line in the header which throws things off.


-Scott

Tags: mail functionservice provideremail