Help pls!! mail() function header problems
| From: | Thomas \"omega\" Henning | Date: | Thu, 11 Jul 2002 13:00:32 +0000 |
| Subject: | Help pls!! mail() function header problems | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-85899@lists.php.net to get a copy of this message | ||
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