繁体   English   中英

php邮件功能和邮件服务器

[英]php mail function and mail server

使用php邮件http://php.net/manual/en/function.mail.php如果邮件发送正常,它将返回true。

但是对于我的Web主机,发送速率为3000 /小时,达到3000的限制(这是3000的限制的15%)后,服务器将存储450封电子邮件。

我想确认的是,当php mail函数返回true时,它将处理这些设置。 邮件服务器是否向邮件功能确认发送了OK,或者邮件功能“不知情”?

邮件服务器对功能说,已达到限制的电子邮件未发送,因此返回false?

使用PHP附带的mail()函数不是最佳解决方案。 使用SWIFTMAILER http://swiftmailer.org/这将用作SMTP服务:

将swiftmailer用作SMTP服务时的代码示例:

require_once 'lib/swift_required.php';

// Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25)
  ->setUsername('your username')
  ->setPassword('your password')
  ;

/*
You could alternatively use a different transport such as Sendmail or Mail:

// Sendmail
$transport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -bs');

// Mail
$transport = Swift_MailTransport::newInstance();
*/

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

// Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('john@doe.com' => 'John Doe'))
  ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
  ->setBody('Here is the message itself')
  ;

// Send the message
$result = $mailer->send($message);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM