Re: sending mail from localhost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/13/07, Stut <stuttle@xxxxxxxxx> 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.php



   It'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@xxxxxxxxxxx";

$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@xxxxxxxxxxx";
//$reply_to = "webmaster@xxxxxxxxxxx"; // 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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux