note 21594 modified in ref.mail by victor
| From: | victor@php.net | Date: | Fri, 06 Sep 2002 15:55:32 +0000 |
| Subject: | note 21594 modified in ref.mail by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-36248@lists.php.net to get a copy of this message | ||
Dear all,
Setting up a system which will ask a new member to confirm he asked for it
by mailing him I experienced a problem. If a new member fills in a Hotmail
e-mailaddress he will receive my mail in his Junk Mail directory.
Many tips I found where telling te configure the php.ini on my server but
that is not enough. I use Apache on a Win32 so some things will be different
for you Linux people but the problems I experienced do not have anything to
do with that I believe.
But, configure your php.ini setting the mail functions, for Win32:
SMTP = mail.yourisp.com
sendmail_from = justsomething@myserver.com
Now the most important.
When using mail() you should insert headers, and not just a few!!!
I give you an example I'm using.
Very important is also to include the ' To: ' header. I forgot this and when
I put it in my code Hotmail didn't refuse my e-mails anymore. Only when
people have there Junk Mail listed as "Exclusive". But when configured
"High" it will go ok.
Here the example:
$myname = "Me Myself";
$myemail = "myself@email.com";
$contactname = "Mister Contact";
$contactemail = "contact@email.com";
$message = "hello from happy me";
$subject = "A mail not refused by Hotmail";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$myname." <".$myemail.">\r\n";
$headers .= "To: ".$contactname." <".$contactemail.">\r\n";
$headers .= "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
mail($contactemail, $subject, $message, $headers);
I hope this helped someone.
Godfried van Loo
The Netherlands
--was--
Dear all,
Setting up a system which will ask a new member to confirm he asked for it
by mailing him I experienced a problem. If a new member fills in a Hotmail
e-mailaddress he will receive my mail in his Junk Mail directory.
Many tips I found where telling te configure the php.ini on my server but
that is not enough. I use Apache on a Win32 so some things will be different
for you Linux people but the problems I experienced do not have anything to
do with that I believe.
But, configure your php.ini setting the mail functions, for Win32:
SMTP = mail.yourisp.com
sendmail_from = justsomething@myserver.com
Now the most important.
When using mail() you should insert headers, and not just a few!!!
I give you an example I'm using.
Very important is also to include the ' To: ' header. I forgot this and when
I put it in my code Hotmail didn't refuse my e-mails anymore. Only when
people have there Junk Mail listed as "Exclusive". But when configured
"High" it will go ok.
Here the example:
$myname = "Me Myself";
$myemail = "myself@email.com";
$contactname = "Mister Contact";
$contactemail = "contact@email.com";
$message = "hello from happy me";
$subject = "A mail not refused by Hotmail";
$headers. = "MIME-Version: 1.0\r\n";
$headers. = "Content-type: text/html; charset=iso-8859-1\r\n";
$headers. = "From: ".$myname." <".$myemail.">\r\n";
$headers. = "To: ".$contactname." <".$contactemail.">\r\n";
$headers. = "Reply-To: ".$myname." <$myreplyemail>\r\n";
$headers. = "X-Priority: 1\r\n";
$headers. = "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: Just My Server";
mail($contactemail, $subject, $message, $headers);
I hope this helped someone.
Godfried van Loo
The Netherlands
http://www.php.net/manual/en/ref.mail.php