Re: help with mail() function!

From: Date: Fri, 12 Jul 2002 13:11:51 +0000
Subject: Re: help with mail() function!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-107359@lists.php.net to get a copy of this message
Try: $header = "From: Test List <irc@mediasoft.ro>"; mail($to, $subject, $fullbody, $header.""); Note the extra Null String concatinated... My php.ini is also configured to show: sendmail_from= In the mail function... This is under WinNT... php 4.2.1 The Null String might work under UNIX too... I haven't tried it... Spike... "Thomas "Omega" Henning" <tomi@mediasoft.ro> wrote in message news:20020712130010.93129.qmail@pb1.pair.com... > Hello all, > > I am trying to build a php driven mailing list where i can send an email to > the whole list. Here is my code: > > <?php > $to = "Henning Tamas <tomi@mediasoft.ro>" . ","; > $header = "From: Test List <irc@mediasoft.ro>"; > > include("pop3.php"); > > $user="irc"; > $password="*****"; > $apop=0; > $pop3_connection=new pop3_class; > $pop3_connection->hostname="localhost"; > if(($error=$pop3_connection->Open())=="") > { > echo "<PRE>Connected to the POP3 server > $pop3_connection->hostname</PRE>\n"; > if(($error=$pop3_connection->Login($user,$password,$apop))=="") > { > echo "<PRE>User $user logged in.</PRE>\n"; > > if(($error=$pop3_connection->RetrieveMessage(1,&$headers,&$body,2))=="") > { > echo "<PRE>Message 1:\n---Message headers starts below---</PRE>\n"; > > for($line=0;$line<count($headers);$line++) { > echo > "<PRE>",HtmlSpecialChars($headers[$line]),"</PRE>\n"; > $fullheader=$fullheader.$headers[$line]."\r\n"; > } > > echo "<PRE>---Message headers ends above---\n---Message body starts > below---</PRE>\n"; > for($line=0;$line<count($body);$line++) { > echo > "<PRE>",HtmlSpecialChars($body[$line]),"</PRE>\n"; $fullbody = > $fullbody . $body[$line]; } > echo "<PRE>---Message body ends above---</PRE>\n"; > } > } > } > if($error=="" > && ($error=$pop3_connection->Close())=="") > echo "<PRE>Disconnected from the POP3 server > $pop3_connection->hostname</PRE>\n"; > > echo("$error"); > $i1=strpos($fullheader,"Subject:"); > $i2=strlen($fullheader)-$i1; > $subject=substr($fullheader,$i1,$i2); > $subject=substr($subject,9,strlen($subject)); > $subject = "[MediaSoft] " . $subject; > //mail($to, $subject, $body, $headers) or die("tet"); > mail($to, $subject, $fullbody, "From: test@mediasoft.ro"); > ?> > I got the pop3.php from www.weberdev.com its a class to download emails from > a POP3 server. My problem is: > When i send an email from a PHP emailer using mail() function to my mailing > list Message Subject is test, Message body is test. I run my script and my > message source looks like this: > Return-Path: <root@MediaSoft.ro> > Delivered-To: tomi@mediasoft.ro > Received: (qmail 30667 invoked by alias); 11 Jul 2002 13:04:08 -0000 > Delivered-To: root@mediasoft.ro > Received: (qmail 30662 invoked by uid 99); 11 Jul 2002 13:04:08 -0000 > Date: 11 Jul 2002 13:04:08 -0000 > Message-ID: <20020711130408.30661.qmail@MediaSoft.ro> > To: Henning Tamas <tomi@mediasoft.ro>, Root <root@mediasoft.ro>, > Subject: [MediaSoft] test > //-------Header ends here -------- I added this line > > From: Test List <irc@mediasoft.ro> > > From: test@mediasoft.ro > > test > > And as you see From: test@mediasoft.ro is in the header section of the > mail() function. > What can I do to fix this problem? > > Thomas Henning > > P.S. I tryed these to fix it: > 1)$header="From: test@mediasoft.ro \r\n"; > 2)$header=""; > mail($to,$subject,$message,$header,-ftest@mediasoft.ro); > >

« previous php.general (#107359) next »