yum -y install sendmail
systemctl start sendmail.service
echo -n | openssl s_client -connect smtp.163.com:465 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > ~/.certs/163.crt
certutil -A -n "GeoTrust SSL CA - G3" -t "Pu,Pu,Pu" -d ./ -i 163.crt
set smtp="smtps://smtp.163.com:465"
set from="xxx@163.com"
set smtp-auth=login
set smtp-auth-user="xxx@163.com"
set smtp-auth-password="xxx" //此处是授权码 不是秘密
set ssl-verify=ignore
set nss-config-dir=/root/.certs //证书路径
echo hello | mail -s "TEST" 1277600680@qq.com
$mail = new PHPMailer(true);
try {
$mail->isSMTP(); //Send using SMTP
$mail->Host = 'smtp.163.com'; //Set the SMTP server to send through
$mail->SMTPAuth = true; //Enable SMTP authentication
$mail->Username = 'shibcogame@163.com'; //SMTP username
$mail->Password = 'ZMRFQMMNIXIVAG'; //SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption
$mail->Port = 465;
$mail->setFrom('shibcoingme@163.com');
$mail->addAddress('127700680@qq.com'); //Name is optional
$mail->isHTML(true); //Set email format to HTML
$code = rand(111111, 999999);
$mail->Subject = 'Your verification code is' . $code;
$mail->send();
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}