扣扣邮箱发送
add_action('phpmailer_init', 'mail_smtp');
function mail_smtp( $phpmailer ) {
$phpmailer->FromName = '随便写'; //名字(对方收到你的邮件会显示的名字)
$phpmailer->Host = 'smtp.qq.com'; //smtp地址,不同服务商各不同
$phpmailer->Port = 465; //端口,要与SMTPSecure对应
$phpmailer->SMTPSecure = 'ssl'; //这个要与上面的端口对应,可填ssl(对应465)或tls(对应25)
$phpmailer->Username = '***************'; //邮箱账号
$phpmailer->Password = '****************'; //邮箱授权码,不是登录密码(登录扣扣邮箱去后台去找)
$phpmailer->From = '*********************';//邮箱账号
$phpmailer->SMTPAuth = true;
$phpmailer->isSMTP();
}
outlook发送邮件将邮件信息存到数据库加密,smtp服务地址等等的去邮箱后台去看
function mail_smtp($phpmailer)
{
global $wpdb;
$sql = "SELECT id, emailUsername, emailPassword FROM wp_lijun_email where id = 1";
$result = $wpdb->get_results($sql);
$userName = $result[0]->emailUsername;
$password = $result[0]->emailPassword;
$emailUser = base64_decode($userName);
$emailPwd = base64_decode($password);
$phpmailer->FromName = 'l***********'; //名字
$phpmailer->Host = 'smtp.office365.com'; //smtp地址,不同服务商各不同
$phpmailer->Port = 587; //端口,要与SMTPSecure对应
$phpmailer->SMTPSecure = 'STARTTLS'; //这个要与上面的端口对应,可填ssl(对应465)或tls(对应25)
$phpmailer->Username = $emailUser;
$phpmailer->Password = $emailPwd;
$phpmailer->From = $userName;;
$phpmailer->SMTPAuth = true;
$phpmailer->isSMTP();
}
add_action('phpmailer_init', 'mail_smtp');
其他gmail(goole邮箱等等邮箱差不多步骤)