Posting code is tricky as to get it all i'd have to copy in half the site, which is why I was hoping someone could spot something bad with the email header. Anyway here is the main function used, hope this helps?
function MyMail( $strToAddr, $strToName, $strSubject, $strEmailURI, $intFormat, $arrFields = array() ) {
//Populate the Fields array with default Variables
$arrFields["Mail-ToAddr"] = $strToAddr;
$arrFields["Mail-ToName"] = $strToName;
$arrFields["Mail-Subject"] = $strSubject;
$arrFields["Mail-Unsub"] = "http://{$_SERVER['HTTP_HOST']}/English/maillist.php?un=" . urlencode($strToAddr);
//Read the Contents of the Email to be sent
$strFileName = PATH_PRIVATE . "emails/$strEmailURI";
if (!($fd = fopen ($strFileName,"r"))) die ("Can't open $filename");
$strContents = fread ($fd , filesize ($strFileName));
fclose($fd);
//Get HTML content
$intStart = strpos( $strContents, "\n", strpos( $strContents, '##HTML' ))+1;
if( !($intEnd = strpos( $strContents, "##", $intStart )) ) $intEnd = strlen( $strContents );
$strHTML_Contents = substr( $strContents, $intStart, $intEnd-$intStart );
//Get TEXT Content
$intStart = strpos( $strContents, "\n", strpos( $strContents, '##TEXT' ))+1;
if( !($intEnd = strpos( $strContents, "##", $intStart )) ) $intEnd = strlen( $strContents );
$strTEXT_Contents = substr( $strContents, $intStart, $intEnd-$intStart );
//Insert Place Holders
if( is_array( $arrFields ) ) {
reset ($arrFields);
while (list ($strKey, $strVal) = each ($arrFields)) {
$strHTML_Contents = str_replace( '['.$strKey.']', $strVal, $strHTML_Contents );
$strTEXT_Contents = str_replace( '['.$strKey.']', $strVal, $strTEXT_Contents );
}
}
$mail = new phpmailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->Host = "mail.moonpod.com"; // specify main and backup server
$mail->$Hostname = "www.moonpod.com"; // From Where?
$mail->From = EMAIL_FROM;
$mail->FromName = "MoonPod";
$mail->AddAddress( $strToAddr, $strToName );
$mail->AddReplyTo( EMAIL_FROM, "Moonpod");
$mail->WordWrap = 50; // set word wrap to 50 characters
$mail->Subject = $strSubject;
//
if( $intFormat == 0 ) {
$mail->IsHTML(true); // set email format to HTML
$mail->Body = $strHTML_Contents;
$mail->AltBody = $strTEXT_Contents;
}
else {
$mail->Body = $strTEXT_Contents;
}
$mail->Send();
}