Re: sending mail from localhost
| From: | Daniel Brown | Date: | Wed, 13 Jun 2007 13:51:21 +0000 |
| Subject: | Re: sending mail from localhost | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-256853@lists.php.net to get a copy of this message | ||
On 6/13/07, Stut <stuttle@gmail.com> wrote:
Ross wrote: ; For Win32 only. sendmail_from = mail.blue-fly.co.uk This should be an email address not just a domain. -Stut -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phpIt's also not necessary to combine single and double quotes with join marks (.'s) as you have it. While this isn't the problem, and Stut is absolutely correct, your code would look cleaner if you did it as follows: <? $to = "nobody@example.com"; $subject = "Message Sent From Website"; $message = "Hi!\n"; $message .= "\tThis is also an example of how to use double quotes\n"; $message .= "to encapsulate special characters such as the newline\n"; $message .= "and tab characters. If you need to escape \"quotes\" you\n"; $message .= "simply backslash them like above. Also, note that this\n"; $message .= "message can be very long by using the dot before the\n"; $message .= "equals sign. Another way to do this would be to use\n"; $message .= "HEREDOC syntax, or simply use one continuing line,\n"; $message .= "but that's for another time and another example.\n"; $from = "webmaster@example.com"; //$reply_to = "webmaster@example.com"; // Same address, so not needed. // The following can be done either way. I prefer the uncommented method. // $headers = "From: $from\r\n"; $headers = "From: ".$from."\r\n"; $headers .= "X-Mailer: PHP".phpversion()."\r\n"; // Headers ALWAYS need \r\n mail($to,$subject,$message,$headers); ?> More than what you asked for, but hopefully it helps. -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107