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 <[EMAIL PROTECTED]>" . ",";
$header = "From: Test List <[EMAIL PROTECTED]>";
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: [EMAIL PROTECTED]");
?>
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: <[EMAIL PROTECTED]>
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 30667 invoked by alias); 11 Jul 2002 13:04:08 -0000
Delivered-To: [EMAIL PROTECTED]
Received: (qmail 30662 invoked by uid 99); 11 Jul 2002 13:04:08 -0000
Date: 11 Jul 2002 13:04:08 -0000
Message-ID: <[EMAIL PROTECTED]>
To: Henning Tamas <[EMAIL PROTECTED]>, Root <[EMAIL PROTECTED]>,
Subject: [MediaSoft] test
//-------Header ends here -------- I added this line
From: Test List <[EMAIL PROTECTED]>
From: [EMAIL PROTECTED]
test
And as you see From: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] \r\n";
2)$header="";
mail($to,$subject,$message,$header,[EMAIL PROTECTED]);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php