phpmailer 基本问题
我正在使用 phpmailer 向我的订阅者发送新闻通讯。
我将标题设置如下:
$headers = "From: Sales - Blah Blah <[email protected]>";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
现在,在发送的电子邮件中,例如在 Gmail 帐户中,如果您按“显示详细信息”链接,则会出现以下内容。
from Sales - Blah Blah MIME-Version: 1.0
[email protected] via ecbiz103.inmotionhosting.com
to [email protected]
date Wed, Aug 3, 2011 at 11:02 AM
subject sales !
***mailed-by ecbiz103.inmotionhosting.com***
问题是:
我怎样才能让它从实际的电子邮件帐户(即“[电子邮件受保护]" 并且能够在我的“已发送”选项卡上查看外发电子邮件吗?
我想,当这种情况发生时,粗体提到的最后一行会说
"mailed by blahblah.com"
问候,乔治
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
PHPmailer 与 http://phpmailer.worxware.com 一样吗?或者您是指 PHP 的内置
mail()
函数?看来您正在使用 mail(),因为您正在构建自己的 MIME 消息。不要那样做。它太主要而且不可靠。使用 PHPmailer(在前面提到的链接)或 Swiftmailer 为您做类似的事情。无论哪种方式,如果您希望发送的邮件显示在帐户的“已发送”文件夹中,则必须使用 blahblah.com 的邮件服务器通过您自己的电子邮件帐户发送电子邮件。另一种选择是设置密件抄送:在每封邮件上默默地复制您自己,并在您的帐户上设置邮件规则以将这些邮件转移到文件夹中。
PHPmailer as in http://phpmailer.worxware.com? Or do you mean PHP's built-in
mail()
function? It would appear you're using mail(), since you're building your own MIME message. Don't do that. It's too much main and unreliable. use PHPmailer (at the link mentioned earlier) or Swiftmailer to do that sort of thing for you.Either way, if you want the mails you send to show up in your account's "sent" folder, you'd have to send the emails via your own email account using blahblah.com's mail server. Another option would be to set a BCC: to silently copy yourself on each mail, and have a mail rule on your account to divert those mails to a folder.
简单的答案是:你不能。
phpmailer 所做的就是连接到邮件服务器来发送邮件。它根本不以任何方式链接到您的实际电子邮件帐户。
编辑:
此外,您将无法删除 ecbiz103.inmotionhosting.com 引用,因为它是发送邮件的服务器的主机名。邮件服务器在一个 IP 地址上运行,该 IP 有一个主机名,在本例中为
ecbiz103.inmotionhosting.com
。The simple answer is: you cant.
All phpmailer does is connect to the mail server to send the mail. It does not link to your actual e-mail account in any way at all.
EDIT:
Also, you will not be able to remove the
ecbiz103.inmotionhosting.com
reference as that is the hostname of the server that is sending the mail. A mail server runs on one IP address, this IP has a hostname, in this caseecbiz103.inmotionhosting.com
.第一行标头之后没有换行符,特别是
From
标头。You don't have a newline after the first line of headers, specifically the
From
header.