php 邮件功能不发送电子邮件/发送电子邮件花费太长时间

发布于 2024-12-25 17:18:07 字数 847 浏览 1 评论 0原文

我有一个机架空间云,我想在其中设置 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独夜无伴 2025-01-01 17:18:07

尝试使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文