【问题标题】:How to use a custom SMTP settings in my WordPress site如何在我的 WordPress 网站中使用自定义 SMTP 设置
【发布时间】:2020-12-04 07:17:36
【问题描述】:

我需要为我的 WordPress 网站使用自定义 SMTP 设置,以通过我的电子邮件服务器(例如 Mailgun 或 SendGrid)发送电子邮件。

【问题讨论】:

  • 有几个插件可以解决这一切。我使用的一种是“Yehuda Hassine 发布 SMTP”。无需乱码,界面简洁。

标签: wordpress smtp phpmailer mailgun email


【解决方案1】:

把它放在你的主题function.php或你自己的插件中。

add_action( 'phpmailer_init', 'custom_phpmailer_init' );
function custom_phpmailer_init( $phpmailer ) {

    $phpmailer->isSMTP();
    $phpmailer->Host = 'smtp.mailgun.com';
    $phpmailer->Port = 465;
    $phpmailer->Username = 'user_name';
    $phpmailer->Password =  '********';
    $phpmailer->SMTPAuth = true;
    $phpmailer->SMTPSecure = 'ssl';
    $phpmailer->From       = 'FromName@example.com';
    $phpmailer->FromName   = 'FromName';

}
猜你喜欢
  • 1970-01-01
  • 2016-08-28
  • 2014-02-16
  • 2020-11-12
  • 2018-10-11
  • 1970-01-01
  • 1970-01-01
  • 2012-07-13
  • 1970-01-01
相关资源
最近更新 更多