自己写了一个邮件发送得代码(PHP写得),发送邮件得时候别得邮箱都正常,唯独在gmail邮箱下 不正常,显示如下 发件人China Mining Hotels <[email protected]>
发送至liuc changjiang <[email protected]>日期2010年6月1日 下午5:37
主题Submission Confirmation
邮送域163.com隐藏详细信息 17:37 (23 分钟前) charset="GB2312" Content-Transfer-Encoding: base64 X-CM-TRANSID:DtGowLCL5ALv1ARMzyZ1AA--.38660S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUSIJmUUUUU Message-Id: <[email protected]> Date: Tue, 1 Jun 2010 17:37:51 +0800 (CST) X-CM-SenderInfo: 50xk4iivy6il2tof0z/1tbiLhfiAElynJ16bwABs1 ztLAtMrUytTQ0LK70NCwoaOstb2119DQsrvQ0LCho6zOqsm2sfDIy7XE08rP5L7NxNzV/bOjt6LQ xcTYo6y2+M7StcO+zbK70NDE2KOsxvjLwM7Swcs=
头部正常,就是 主体body 不正常,很是郁闷, 其他邮箱是这样得
Submission Confirmation
To :liu changjiang Email :[email protected]
From :China Mining Hotels Tel No. :+86-22-88353236
Date :2010-06-01 Hotel Name :Hotel Nikko Tianjin
Thank you for your reservation.We are pleased to confirm your reservation
as follows:
Name of Guest :liu changjiang,23
Arrival Date :2010-06-08 No. of Rooms :1
Departure Date :2010-07-05 Room Type :Double Room
Room Rate :$0 Extra Breakfast :0 ($0)
Total Charge :$0 Extra Bed :0 ($0)
Res :
Check-in Time : 1400 hours Check-out Time : 1200 hours
Cancellation Policy in June
If you make a reservation and pay during this period, you can enjoy our special price in June. And if you cancel or change your reservation within a week, you don’t need to pay any fees. However, if you cancel or change your reservation after a week, we will take a night of the room rate as the compensation for breach of contract.
For Reservations,please login www.chinamininghotels.com
or e-mail:[email protected]
No.84 Qu Fu Road , Heping District , Tianjin , China
Tel:(86-22) 88353289 88353236
Fax:(86-22) 88354117 以上内容是有格式得 出来之后 是一个表格形式得,但是在 gmail 邮箱下就是不行,快崩溃了,各位大侠们帮帮忙吧,小弟感激不尽
邮件发送部分如下 function build_content($bound_level=0,$text_body,$html_body,$hava_att=false)
{
if ($html_body)
{
if (eregi("\<*img[[:space:]]+src[[:space:]]*=[[:space:]]*([^ ]+)",$html_body,$reg))
{
$bound_level++;
if ($text_body)
{
$this->body.="Content-Type: multipart/related;
type=\"multipart/alternative\";
boundary=\"";
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
}
else
{
$this->body.="Content-Type: multipart/related;
boundary=\"";
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
} // 对于是否 text 正文 、 html正文 有没有,须有不同的 MIME 头
if (!$hava_att) $this->body.="This is a multi-part message in MIME format.\r\n\r\n";
// 正文标识,如果是已经有附件的编码,则在正文 中不需要这一句
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->parse_html_body($html_body);
if ($text_body)
{
$this->body.="Content-Type: multipart/alternative;
boundary=\"";
$bound_level++;
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/plain;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($text_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/html;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--\r\n\r\n";
$bound_level--;
}
else
{
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/html;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
} //正文编码,有或没有 text 部分,编成不同的格式。
for ($i=0;$i<count($this->temp_body_images);$i++)
{
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type:".$this->temp_body_images[$i][type].";
name=\"";
$this->body.=$this->temp_body_images[$i][name]."\"\r\n";
$this->body.="Content-Transfer-Encoding: base64\r\n";
$this->body.="Content-ID: <".$this->temp_body_images[$i][cid].">\r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_body_images[$i][data])))."\r\n";
}
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--\r\n\r\n";
$bound_level--;
}
else // 有或没有图片,以上是有图片的处理,下面是没有图片的处理
{
$this->temp_html_body=$html_body;
if ($text_body)
{
$bound_level++;
$this->body.="Content-Type: multipart/alternative;
boundary=\"";
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
if (!$hava_att) $this->body.="\r\nThis is a multi-part message in MIME format.\r\n\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/plain;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($text_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/html;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--\r\n\r\n";
$bound_level--;
}
else
{
$this->body.="Content-Type: text/html;\r\n";
print "thisbody=".$this->body."<br />";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
print "thisbody=".$this->body."<br />";
} //正文编码,有或没有 text 部分,编成不同的格式。
} // end else
}
else // 如果没有 html 正文,只有 text 正文
{
$this->body.="Content-Type: text/plain;
charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($text_body)))."\r\n";
}
} // end function default 这个方法是构建发送主体得
发送至liuc changjiang <[email protected]>日期2010年6月1日 下午5:37
主题Submission Confirmation
邮送域163.com隐藏详细信息 17:37 (23 分钟前) charset="GB2312" Content-Transfer-Encoding: base64 X-CM-TRANSID:DtGowLCL5ALv1ARMzyZ1AA--.38660S3 X-Coremail-Antispam: 1Uf129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UbIYCTnIWIevJa73UjIFyTuYvjxUSIJmUUUUU Message-Id: <[email protected]> Date: Tue, 1 Jun 2010 17:37:51 +0800 (CST) X-CM-SenderInfo: 50xk4iivy6il2tof0z/1tbiLhfiAElynJ16bwABs1 ztLAtMrUytTQ0LK70NCwoaOstb2119DQsrvQ0LCho6zOqsm2sfDIy7XE08rP5L7NxNzV/bOjt6LQ xcTYo6y2+M7StcO+zbK70NDE2KOsxvjLwM7Swcs=
头部正常,就是 主体body 不正常,很是郁闷, 其他邮箱是这样得
Submission Confirmation
To :liu changjiang Email :[email protected]
From :China Mining Hotels Tel No. :+86-22-88353236
Date :2010-06-01 Hotel Name :Hotel Nikko Tianjin
Thank you for your reservation.We are pleased to confirm your reservation
as follows:
Name of Guest :liu changjiang,23
Arrival Date :2010-06-08 No. of Rooms :1
Departure Date :2010-07-05 Room Type :Double Room
Room Rate :$0 Extra Breakfast :0 ($0)
Total Charge :$0 Extra Bed :0 ($0)
Res :
Check-in Time : 1400 hours Check-out Time : 1200 hours
Cancellation Policy in June
If you make a reservation and pay during this period, you can enjoy our special price in June. And if you cancel or change your reservation within a week, you don’t need to pay any fees. However, if you cancel or change your reservation after a week, we will take a night of the room rate as the compensation for breach of contract.
For Reservations,please login www.chinamininghotels.com
or e-mail:[email protected]
No.84 Qu Fu Road , Heping District , Tianjin , China
Tel:(86-22) 88353289 88353236
Fax:(86-22) 88354117 以上内容是有格式得 出来之后 是一个表格形式得,但是在 gmail 邮箱下就是不行,快崩溃了,各位大侠们帮帮忙吧,小弟感激不尽
邮件发送部分如下 function build_content($bound_level=0,$text_body,$html_body,$hava_att=false)
{
if ($html_body)
{
if (eregi("\<*img[[:space:]]+src[[:space:]]*=[[:space:]]*([^ ]+)",$html_body,$reg))
{
$bound_level++;
if ($text_body)
{
$this->body.="Content-Type: multipart/related;
type=\"multipart/alternative\";
boundary=\"";
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
}
else
{
$this->body.="Content-Type: multipart/related;
boundary=\"";
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
} // 对于是否 text 正文 、 html正文 有没有,须有不同的 MIME 头
if (!$hava_att) $this->body.="This is a multi-part message in MIME format.\r\n\r\n";
// 正文标识,如果是已经有附件的编码,则在正文 中不需要这一句
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->parse_html_body($html_body);
if ($text_body)
{
$this->body.="Content-Type: multipart/alternative;
boundary=\"";
$bound_level++;
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/plain;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($text_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/html;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--\r\n\r\n";
$bound_level--;
}
else
{
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/html;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
} //正文编码,有或没有 text 部分,编成不同的格式。
for ($i=0;$i<count($this->temp_body_images);$i++)
{
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type:".$this->temp_body_images[$i][type].";
name=\"";
$this->body.=$this->temp_body_images[$i][name]."\"\r\n";
$this->body.="Content-Transfer-Encoding: base64\r\n";
$this->body.="Content-ID: <".$this->temp_body_images[$i][cid].">\r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_body_images[$i][data])))."\r\n";
}
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--\r\n\r\n";
$bound_level--;
}
else // 有或没有图片,以上是有图片的处理,下面是没有图片的处理
{
$this->temp_html_body=$html_body;
if ($text_body)
{
$bound_level++;
$this->body.="Content-Type: multipart/alternative;
boundary=\"";
$this->body.=$this->bound_begin.$bound_level.$this->bound_end."\"\r\n\r\n";
if (!$hava_att) $this->body.="\r\nThis is a multi-part message in MIME format.\r\n\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/plain;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($text_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."\r\n";
$this->body.="Content-Type: text/html;\r\n";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
$this->body.="--".$this->bound_begin.$bound_level.$this->bound_end."--\r\n\r\n";
$bound_level--;
}
else
{
$this->body.="Content-Type: text/html;\r\n";
print "thisbody=".$this->body."<br />";
$this->body.="charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($this->temp_html_body)))."\r\n";
print "thisbody=".$this->body."<br />";
} //正文编码,有或没有 text 部分,编成不同的格式。
} // end else
}
else // 如果没有 html 正文,只有 text 正文
{
$this->body.="Content-Type: text/plain;
charset=\"$this->charset\"\r\n";
$this->body.="Content-Transfer-Encoding: base64 \r\n";
$this->body.="\r\n".chunk_split(base64_encode(StripSlashes($text_body)))."\r\n";
}
} // end function default 这个方法是构建发送主体得
那是不是 我只要改成 utf-8编码得 就正常了么