配置 SilverStripe 3.x 以使用外部 SMTP 邮件服务器

Configure SilverStripe 3.x to use an external SMTP mail server

SilverStripe 中是否有一些简单的配置选项可以使用外部 SMTP 服务器(例如 Mandrill)发送电子邮件?我现阶段不看模块,我只是想知道它是否可以开箱即用。

Silverstripe 使用 php 的 mail() function to send the email (see source), so you might be able to configure it using ini_set(),具体取决于您服务器的安全设置,例如在 /mysite/_config.php:

ini_set("SMTP","smtp.example.com" );

恕我直言,最好在服务器的 php.ini.

中全局设置它

另见 mail configuration in PHP Manual

PS:您可能对 Silverstripe Mandrill module?

感兴趣

有许多 Mailer 替换模块可以让您执行经过身份验证的 SMTP。这是一个可以尝试的列表:

http://addons.silverstripe.org/add-ons?search=mailer&type=module&sort=

我写了其中一个 (https://github.com/markguinn/silverstripe-email-helpers),它使用 PHPMailer 并且是我最近使用的唯一一个。我发现如果您只是发送简单的电子邮件,实际与 Mandrill 集成的模块通常比需要的更复杂。