希望我能得到一些帮助,因为这让我发疯。
我已经尝试了各种脚本来做到这一点,但我登陆的是这个。这张照片有什么问题?我收到一封电子邮件,但它完全空白。但是,电子邮件的来源有内容。
电子邮件代码
//define receiver and subject
$to = 'email@gmail.com';
$subject = 'Test email';
//create boundary
$random_hash = md5(date('r', time()));
//define the headers
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"$random_hash\"";
//define the body of the message.
$message = "--$random_hash\n" .
"Content-Type: text/plain; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\r" .
"Hello\n\rWorld!!!\n\r" .
"--$random_hash\n" .
"Content-Type: text/html; charset=\"iso-8859-1\"\n" .
"Content-Transfer-Encoding: 7bit\n\r" .
"<h2>Hello World!</h2>\n\r" .
"--$random_hash--";
//send the email
$mail_sent = mail( $to, $subject, $message, $headers );
电子邮件来源(已收到)
Received: (qmail 26359 invoked by uid 48); 21 Mar 2013 10:09:01 -0700
Date: 21 Mar 2013 10:09:01 -0700
Message-ID: <20130321170901.26356.qmail@mydomain.com>
To: me@mydomain.com
Subject: Test email
X-PHP-Originating-Script: 10001:plug-send-direct.php
From: webmaster@example.com
Reply-To: webmaster@example.com
Content-Type: multipart/alternative; boundary="f41fbfe6fda45eb7f5a2724ba135d292"
--f41fbfe6fda45eb7f5a2724ba135d292
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Hello
World!!!
--f41fbfe6fda45eb7f5a2724ba135d292
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
<h2>Hello World!</h2>
--f41fbfe6fda45eb7f5a2724ba135d292--
是什么赋予了?