php 邮件功能不发送电子邮件/发送电子邮件花费太长时间
我有一个机架空间云,我想在其中设置 LAMP。服务器有CentOS。
我安装了sendmail并且php邮件功能使用这个,但是使用php邮件功能发送电子邮件需要很长时间
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
$to = "[email protected]"
$subject = "activation code";
$message = "Activation code: 10";
$from = "[email protected] ";
$headers = "From: $from";
if(mail($to, $subject, $message, $headers)) {
echo 'success';
}
else { echo 'deny'; }
,但这需要很多时间,当我向rackspace询问这个问题时,他们说邮件功能可能正在使用公共邮件服务器发送电子邮件,由于队列太长,需要时间。但我也有另一个电子邮件服务器。
无论如何我可以让它快速工作吗?我可以安装发送邮件以使用我拥有的电子邮件服务器吗?
I have a rackspace cloud where I want to set up LAMP. the server has CentOS.
I have sendmail installed and the php mail function use this, but it takes too long to send an email using the php mail function
<?php
ini_set('display_errors', true);
error_reporting(E_ALL);
$to = "[email protected]"
$subject = "activation code";
$message = "Activation code: 10";
$from = "[email protected] ";
$headers = "From: $from";
if(mail($to, $subject, $message, $headers)) {
echo 'success';
}
else { echo 'deny'; }
but this takes a lot of time, and when I ask rackspace about this they said the mail function might be using a public mailserver to send emails and as the queue is too long it takes time. but I have another email server too.
is there anyway I can get this to work fast? and can I make the send mail installation to use that email server I have ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用 PHP Pear Mail 包,它允许您通过 sendmail、pop、smtp 或 imap 发送 http://pear.php.net/packages.php?catpid=14&catname=Mail 还可以轻松添加附件和队列消息。
我的机架空间云上也遇到了同样的问题,这解决了它。
Try using the PHP Pear Mail package it allows you to send via sendmail, pop, smtp, or imap http://pear.php.net/packages.php?catpid=14&catname=Mail theres also the ability to easily add attachments and queue messages.
I had the same issue on my rackspace cloud and this resolved it.