[thelist] PHP mail headers problem....

CDitty mail at redhotsweeps.com
Fri May 24 10:34:01 CDT 2002


I am having problems with PHP mail headers. I am successfully getting the
MIME-Version and Content-type, but when I insert them into the forwarded
email message, the headers show within the email itself. Below is the code
I am using.

// To email address
if(substr($lines[$i], 0, 2) == "To"){
         $To = substr($lines[$i], 4, strlen($lines[$i]));
         eregi("([A-Z0-9\.\-]+@[A-Z0-9\.\-]+\.[A-Z\.]+)", $To, $To);
}elseif(substr($lines[$i], 0, 4) == "From"){// From email address
         $From = substr($lines[$i], 6, strlen($lines[$i]));
         eregi("([A-Z0-9\.\-]+@[A-Z0-9\.\-]+\.[A-Z\.]+)", $From, $From);
}elseif(substr($lines[$i], 0, 7) == "Subject"){// Email subject
         $Subject = substr($lines[$i], 9, strlen($lines[$i]));
}elseif(substr($lines[$i], 0, 12) == "MIME-Version"){// Email subject
         $Mime_Version = substr($lines[$i], 14, strlen($lines[$i]));
}elseif(substr($lines[$i], 0, 12) == "Content-Type"){// Email subject
         $Content_Type = substr($lines[$i], 14, strlen($lines[$i]));
}

if(IsSet($Mime_Version)){
         $Mime_Version = "MIME-Version: $Mime_Version\r\n";
}
if(IsSet($Content_Type)){
         $Content_Type = "Content-type: $Content_Type\r\n";
}

$to = "$user_email[0]";
$subj = "$Subject";
$msg = "$Message";
$headers = "From: $From[1]\n";
$headers .= "$Mime_Version\n";
$headers .= "$Content_Type\n";
mail($to, $subj, $msg, $headers);

This is what the email looks like.

Return-Path: <mail>
Received: (from mail at localhost)
by redhotsweeps.com (8.9.3/8.9.3) id VAA27003;
Thu, 23 May 2002 21:23:51 -0500
Date: Thu, 23 May 2002 21:23:51 -0500
Message-Id: <200205240223.VAA27003 at redhotsweeps.com>
To: XXXXXXX at redhotsweeps.com
Subject: test
From: XXXXXXX at redhotsweeps.com
Status:

Content-type: text/plain; charset="us-ascii"; format=flowed

test 1234


Can anyone give me any tips?

Thanks
CDitty





More information about the thelist mailing list