RE: [PHP] Re: Getting mail() to work with YAHOO! and other mail services
| From: | Julien Wadin | Date: | Fri, 18 Apr 2003 21:39:15 +0000 |
| Subject: | RE: [PHP] Re: Getting mail() to work with YAHOO! and other mail services | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-144440@lists.php.net to get a copy of this message | ||
Just remove the \r at the end of each line
I had the same problem
Bye
__________________________________________________________________
WADIN JULIEN
URL : www.campinfm.be.tf
-----Message d'origine-----
De : Monty [mailto:monty3@hotmail.com]
Envoyé : vendredi 18 avril 2003 23:21
À : php-general@lists.php.net
Objet : [PHP] Re: Getting mail() to work with YAHOO! and other mail
services
> From: rclocked@maine.rr.com (Robert Clockedile)
> Reply-To: <robert@clockedile.com>
> Newsgroups: php.general
> Date: Fri, 18 Apr 2003 16:05:12 -0400
> To: <php-general@lists.php.net>
> Subject: Getting mail() to work with YAHOO! and other mail services
>
> I have a script that is intended to email a user a new password, when they
> have forgotten their old one. The script works perfectly, except when
being
> sent to my YAHOO! email address (and I am told the same is true for
> Hotmail). There is no error message, and as far as the mail server is
> concerned, the email is sent without a problem. It just never shows up on
> the other end.
>
> The script is very simple:
>
> mail($useremail, $subject, $message, "From:
> customerservice@essaytech.com\r\n", "Reply-To:
> customerservice@essaytech.com");
>
> I have tried various header configurations that I have found in the
> documentation, and on other sites. For example, this send_mail() function
> (which I couldn't get to send out any messages, at all).
>
>
> send_mail("member@essaytech.com", $memberEMAIL,"Essaytech Executives",
> $list, $subject, $usermessage);
>
> function send_mail($sendername, $senderemail, $contactname,
> $contactemail, $subject, $message)
> {
> $headers .= "MIME-Version: 1.0\r\n";
> $headers .= "Content-type: text/plain;
> charset=iso-8859-1\r\n";
> $headers .= "X-Priority: 1\r\n";
> $headers .= "X-MSMail-Priority: High\r\n";
> $headers .= "X-Mailer: PHP\r\n";
> $headers .= "To: ".$contactname." < ".$contactemail."
>> \r\n";
> $headers .= "From: ".$sendername."< ".$senderemail."
>> \r\n";
>
>
> I am running PHP 4.2 on Windows XP, on a shared infrastructure at a web
> host. I am relatively new to PHP (a couple of weeks), so any help that
> anyone can provide would be greatly appreciated.
>
> Thanks
>
> --
> Rob Clockedile
> rclockedile@essaytech.com
>
Here's a function I found and slightly modified that I've used and it seems
to send e-mail to Yahoo and Hotmail fine based on my limited tests:
/*------------------------------------------------------------------------
-- Send Mail Function
-------------------------------------------------------------------------
$From ... sender mail address like "my@address.com"
$FromName ... sender name like "My Name"
$To ... recipient mail address like "your@address.com"
$ToName ... recipients name like "Your Name"
$Subject ... subject of the mail like "This is my first testmail"
$Text ... text version of the mail
$Html ... html version of the mail
-----------------------------------------------------------------------*/
function SendMail($From,$FromName,$To,$ToName,$Subject,$Text,$Html) {
$OB="----=_OuterBoundary_000";
$IB="----=_InnerBoundery_001";
$headers ="MIME-Version: 1.0\r\n";
$headers.="From: ".$FromName." <".$From.">\n";
$headers.="To: ".$ToName." <".$To.">\n";
$headers.="Reply-To: ".$FromName." <".$From.">\n";
$headers.="X-Sender: <$From>\n";
$headers.="X-Priority: 3\n";
$headers.="X-MSMail-Priority: High\n";
$headers.="X-Mailer: PHP Mailer\n";
$headers.= "Return-Path: <$From>\n"; // Return path for errors
$headers.="Content-Type:
multipart/mixed;\n\tboundary=\"".$OB."\"\n";
//Messages start with text/html alternatives in OB
$Msg ="This is a multi-part message in MIME format.\n";
$Msg.="\n--".$OB."\n";
$Msg.="Content-Type:
multipart/alternative;\n\tboundary=\"".$IB."\"\n\n";
//plaintext section
$Msg.="\n--".$IB."\n";
$Msg.="Content-Type: text/plain;\n\tcharset=\"iso-8859-1\"\n";
$Msg.="Content-Transfer-Encoding: quoted-printable\n\n";
// plaintext goes here
$Msg.=$Text."\n\n";
// html section
$Msg.="\n--".$IB."\n";
$Msg.="Content-Type: text/html;\n\tcharset=\"iso-8859-1\"\n";
$Msg.="Content-Transfer-Encoding: base64\n\n";
// html goes here
$Msg.=chunk_split(base64_encode($Html))."\n\n";
// end of IB
$Msg.="\n--".$IB."--\n";
//message ends
$Msg.="\n--".$OB."--\n";
mail($To,$Subject,$Msg, $headers);
return;
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php