Re: Sending mail with php-

From: Date: Wed, 11 Jan 2006 22:20:13 +0000
Subject: Re: Sending mail with php-
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228501@lists.php.net to get a copy of this message
On 1/11/06, Duffy, Scott E <scott-duffy@uiowa.edu> wrote: > > This is what I use to send email via php. I have sent hundreds at once. > > > $fromname="Cohen, Dotan"; > $fromaddress="dotan@lyricslist.com"; > $subject ="Subject"; > $message="message body"; > $from=" dotan@lyricslist.com"; > $headers = "MIME-Version: 1.0\n"; > $headers .= "Content-type: text/plain; charset=iso-8859-1\n"; > $headers .= "X-Priority: 3\n"; > $headers .= "X-MSMail-Priority: Normal\n"; > $headers .= "X-Mailer: php\n"; > $headers .= "From: \"".$fromname."\" > <".$fromaddress.">\n"; > //return mail($toaddress, $subject, $message, $headers); > $toAddress='dotancohen@gmail.com'; > mail($toAddress,$subject,$message,$headers); > > good luck > > > Scott Duffy > > -----Original Message----- > From: Dotan Cohen [mailto:dotancohen@gmail.com] > Sent: Wednesday, January 11, 2006 2:49 PM > To: Sameer N Ingole > Cc: php-general@lists.php.net > Subject: Re: [PHP] Sending mail with php- > > On 1/10/06, Sameer N Ingole <strike@proscrutiny.com> wrote: > > Dear Dotan, > > Dotan Cohen wrote: > > > > >On my home Fedora Core 4 box I run Apache 2.0. Sometimes when sending > > >mail with php no mail is delivered, and I find this in the logs: > > > > > ><<< 550-Verification failed for <apache@localhost.localdomain> > > ><<< 550-unrouteable mail domain "localhost.localdomain" > > ><<< 550 Sender verify failed > > > > > You are getting this error because apache@localhost.localdomain cannot > > be reached from Internet and whoever you are sending mail to may have > > something called sender check. This verifies if the sender of this > mail > > is reachable. This avoids spammers to send mails using unreachable > > addresses. Also he may be checking spf-record for your From: domain on > > mail envelop. > > > > > > > >So I changed the only email address in httpd.conf to: > > >ServerAdmin dotan@lyricslist.com > > > > > What error you are getting after you change address in apache and try > > sending mail after restarting apache? > > > > > > > >But I still get the error! I did restart apache and even went so far > as to > > >reboot the machine. If I cannot modify the parameter within apache, > > >then where should I modify it? Within php? Within sendmail? > > > > > > > Excact same error. Actually, this was working fine until recently. I > use the script (homemade) to send out the http://lyricslist.com > monthly newsletter every month- and only this month am I having > problems. No changes made to apache, php, or sendmail except the > regular updates. Could an update have broken this? > > Dotan Cohen > http://technology-sleuth.com/short_answer/what_is_hdtv.html > 876 > Thanks. The parts refering to the sender I _do_ have. The messages are (for those who signed up for html) part html and part text. Here are my headers: --snip-- $from = "Dotan Cohen <lyricslist@dotancohen.com>"; $subject = "LyricsList Newsletter - January 2006"; --snip-- $headers = "From: $from\n"; $headers .= "Reply-To: $from\n"; $headers .= "Date: ".date("r")."\n"; $headers .= "X-Mailer: Dotan Cohen's Homebrew PHP Mailer (http://dotancohen.com)\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed;\n\tboundary=\"----=".rand(100000000000,999999999999)."\"\n"; --snip-- mail ($subscriber[0], $subject, $message, $headers); --snip-- $subscriber[0] is the users email address (1 is text/html preferance, 2 is IP,...). When I send it to my Yahoo address for testing, it goes through. Everywhere else (gmail.com, hotmail.com, dotancohen.com), it fails with the error that I previously described. Relevant parts of the headers that I take from mail.yahoo.com look like this: X-Originating-IP: [192.117.111.61] Return-Path: <apache@localhost.localdomain> Authentication-Results: mta144.mail.mud.yahoo.com from=dotancohen.com; domainkeys=neutral (no sig) Received: from 192.117.111.61 (EHLO localhost.localdomain) (192.117.111.61) by mta144.mail.mud.yahoo.com with SMTP; Wed, 11 Jan 2006 12:40:14 -0800 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.13.4/8.13.4) with ESMTP id k0BKiiYo004610 for <dotancohen@yahoo.com>; Wed, 11 Jan 2006 22:44:44 +0200 Received: (from apache@localhost) by localhost.localdomain (8.13.4/8.13.4/Submit) id k0BKihHI004609; Wed, 11 Jan 2006 22:44:43 +0200 From: "Dotan Cohen" <lyricslist@dotancohen.com> Add to Address BookAdd to Address Book Reply-to: Dotan Cohen <lyricslist@dotancohen.com> 192.117.111.61 is my home IP address (constant). Somewhere, the From information is being written over by the default apache values. Where can I change that? The email address in httpd.conf has already been changed to my address. Dotan Cohen http://technology-sleuth.com/technical_answer/what_is_hdtv.html 823

« previous php.general (#228501) next »