小编use*_*549的帖子

使用Wordpress发送电子邮件

我尝试了很多不同的方法,但无法使用该mail()函数在PHP中通过SMTP成功发送电子邮件.

 <?php
require_once ABSPATH . WPINC . '/class-phpmailer.php';
require_once ABSPATH . WPINC . '/class-smtp.php';
$phpmailer = new PHPMailer();
$phpmailer->SMTPAuth = true;
$phpmailer->Username = 'skchourasia@asselslutions.com';
$phpmailer->Password = 'password01';
 
$phpmailer->IsSMTP(); // telling the class to use SMTP
$phpmailer->Host       = "mail.asselsolutions.com"; // SMTP server
$phpmailer->FromName   = $_POST[your_email];
$phpmailer->Subject    = $_POST[your_subject];
$phpmailer->Body       = $_POST[your_message];                      //HTML Body
$phpmailer->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$phpmailer->WordWrap   = 50; // set word wrap …
Run Code Online (Sandbox Code Playgroud)

php wordpress sendmail

5
推荐指数
1
解决办法
4743
查看次数

标签 统计

php ×1

sendmail ×1

wordpress ×1