我在通过PHP/IMAP电子邮件发送一个问题 - 我不知道这是否是因为:如何从PHP发送IMAP帐户的电子邮件?
- 我不正确认识IMAP或
- 有我的服务器 问题
我的应用程序打开一个电子邮件帐户的IMAP连接来阅读收件箱中的邮件。它成功地做到了。我遇到的问题是我想从此帐户发送邮件并将它们显示在发件箱/发送文件夹中。
据我所知,PHP imap_mail()函数并没有以任何方式挂接到我目前打开的IMAP流中。
我的代码执行时不会引发错误。但是,电子邮件永远不会到达收件人,也不会显示在我发送的文件夹中。
private function createHeaders() {
return "MIME-Version: 1.0" . "\r\n" .
"Content-type: text/html; charset=iso-8859-1" . "\r\n" .
"From: " . $this->accountEmail . "\r\n";
}
private function notifyAdminForCompleteSet($urlToCompleteSet) {
$message = "
<p>
In order to process the latest records, you must visit
<a href='$urlToCompleteSet'>the website</a> and manually export the set.
</p>
";
try {
imap_mail(
$this->adminEmail,
"Alert: Manual Export of Records Required",
wordwrap($message, 70),
$this->createHeaders()
);
echo(" ---> Admin notified via email!\n");
}
catch (Exception $e) {
throw new Exception("Error in notifyAdminForCompleteSet()");
}
}
我猜我需要手动将邮件复制到IMAP帐户...或者是否有不同的解决方案来解决这个问题?
此外,如果“发件人”地址中的域与运行此脚本的服务器中的域不同,是否有关系?我无法解释为什么邮件永远不会发送。
imap_mail()返回“1”,所以我会检查日志。 – arthurakay 2010-12-22 20:08:21