[原创]解决postfix环境下igenus的Return-Path问题(使用smtp)[2]

[入库:2005年9月21日] [更新:2007年3月24日]

本文简介:

$mailHeader .=  "--".$attachmentBoundary. "\n";   

//--TEXT ONLY
  if( $this->mailText!="" && $this->mailHTML==""){
$textHeader = $this->formatTextHeader();
$mailHeader .= $textHeader;
  }
//--HTML ONLY
  if($this->mailText=="" && $this->mailHTML!=""){
$htmlHeader = $this->formatHTMLHeader();
$mailHeader .= $htmlHeader;
  }
  
  if($this->mailText!="" && $this->mailHTML!=""){
 //--TEXT AND HTML--
 //--get random boundary for content types
$bodyBoundary = $this->getRandomBoundary(1);
 //--format headers
$textHeader = $this->formatTextHeader();
$htmlHeader = $this->formatHTMLHeader();
 //--set up main content header with boundary
$mailHeader .=  "Content-Type:; multipart/alternative;\n";
$mailHeader .=  "\tboundary=\"$bodyBoundary\"\n\n";

 //--add body and boundaries
$mailHeader .=  "--".$bodyBoundary. "\n";
$mailHeader .= $textHeader."\n";
$mailHeader .=  "--".$bodyBoundary. "\n";
 //--add html and ending boundary
$mailHeader .= $htmlHeader;
$mailHeader .=  "\n--".$bodyBoundary. "--\n";
 //--send message
 //--END TEXT AND HTML
}
 //--get array of attachment filenames
$attachmentArray = explode( ",",$this->mailAttachments);
 //--loop through each attachment
for($i=0;$i<count($attachmentArray);$i++){
  $mailHeader .=  "\n--".$attachmentBoundary. "\n";
  $mailHeader .= $this->formatAttachmentHeader($attachmentArray[$i]);
}
$mailHeader .=  "--".$attachmentBoundary. "--";
}
if($SaveTo=='Backup'){
($FD_BACKUP = fopen($Path,"w")) || die("Error open $Path");
$BackMeg = "To:; ".$this->mailTo."\n";
$BackMeg .= "Subject:; ".$subject."\n";
$BackMeg .= $mailHeader;
$Slen = strlen($BackMeg);
fputs($FD_BACKUP,$BackMeg,$Slen);
fclose($FD_BACKUP);
return;
}else{
// return mail($this->mailTo,$subject,"",$mailHeader);
$connect = fsockopen ("localhost", 25, $errno, $errstr, 30) or die("Could not talk to the sendmail server!"); 
$rcv = fgets($connect, 1024); 

fputs($connect, "HELO localhost\r\n"); 
$rcv = fgets($connect, 1024); 

fputs($connect, "MAIL FROM:;$this->mailFrom\r\n"); 
$rcv = fgets($connect, 1024);

$addressArray=explode(",",$this->mailTo);
for($i=0;$i<count($addressArray);$i++){
if($this->checkEmail($addressArray[$i]));
{
fputs($connect, "RCPT TO:;$addressArray[$i]\r\n");
$rcv = fgets($connect, 1024);
}
}

$addressArray=explode(",",$this->mailCC);
for($i=0;$i<count($addressArray);$i++){
if($this->checkEmail($addressArray[$i]));
{
fputs($connect, "RCPT TO:;$addressArray[$i]\r\n");
$rcv = fgets($connect, 1024);
}
}

$addressArray=explode(",",$this->mailBCC);
for($i=0;$i<count($addressArray);$i++){
if($this->checkEmail($addressArray[$i]));
{
fputs($connect, "RCPT TO:;$addressArray[$i]\r\n");

本文关键:[原创]解决postfix环境下igenus的Return-Path问题(使用smtp)
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top