andriilive / wp-phpmailer-smtp
配置 wordpress PHPMailer 通过 SMTP 发送邮件。
dev-main
2024-09-02 14:26 UTC
Requires
- php: >=8.0
This package is auto-updated.
Last update: 2024-10-02 14:45:20 UTC
README
通过在 wp-config.php
文件中定义 SMTP 配置来配置 WP PHPMailer 通过 SMTP 发送邮件。
- 需要至少 PHP
8.0
- 在 WP
5.8.1
-6.4.1
上测试过 - 支持 Bedrock
WordPress
安装
Bedrock 安装
- 编辑
.env
文件 - 通过 composer 需求此包
# Required SMTP configuration SMTP_HOST=smtp.xxx.com SMTP_PORT=465 SMTP_USERNAME=bot@digitalandy.eu SMTP_PASSWORD=xxxxxxxx # Optional SMTP_FROM=bot@digitalandy.eu SMTP_FROM_NAME=Bot DISABLE_WP_PHPMAILER_SMTP=true SMTP_REPLY_TO=hi@digitalandy.eu
composer require andriilive/wp-phpmailer-smtp
手动安装
- 编辑
wp-config.php
文件 - 将
wp-phpmailer-smtp.php
文件放入mu-plugins
或plugins
目录
wp-config.php
将 SMTP 配置添加到 wp-config.php 文件中
/* Required SMTP configuration */ define('SMTP_HOST', 'smtp.xxx.com'); define('SMTP_PORT', 465); define('SMTP_USERNAME', 'bot@digitalandy.eu'); define('SMTP_PASSWORD', 'xxxxxxxx'); /* Optional */ define('SMTP_FROM', 'bot@digitalandy.eu'); // From email define('SMTP_FROM_NAME', 'Bot'); // From name define('DISABLE_WP_PHPMAILER_SMTP', true); // Disable WP PHPMailer SMTP define('SMTP_REPLY_TO', ''); // Adds reply-to header
下载 wp-phpmailer-smtp.php
在 mu-plugins
或 plugins
目录中运行以下命令
wget https://raw.githubusercontent.com/digitalandy/wp-phpmailer-smtp/main/wp-phpmailer-smtp.php -O wp-phpmailer-smtp.php