note 21594 added to ref.mail

From: Date: Mon, 20 May 2002 18:21:15 +0000
Subject: note 21594 added to ref.mail
Groups: php.notes 
Request: Send a blank email to php-notes+get-30806@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 -- http://www.php.net/manual/en/ref.mail.php http://master.php.net/manage/user-notes.php?action=edit+21594 http://master.php.net/manage/user-notes.php?action=delete+21594 http://master.php.net/manage/user-notes.php?action=reject+21594

« previous php.notes (#30806) next »