PHP code example of yonghua4413 / smtp
1. Go to this page and download the library: Download yonghua4413/smtp library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yonghua4413 / smtp example snippets
//引入
use YYHemail\smtp;
$mailto='接受者邮箱';
$mailsubject="邮件标题";
$mailbody= '邮件内容';
$smtpserver = "smtpdm.aliyun.com";
$smtpserverport = 80;#端口
$smtpusermail = "发信地址";
$smtpuser = "发信地址";
$smtppass = "smtp密码";
$mailsubject = "=?UTF-8?B?" . base64_encode($mailsubject) . "?=";
$mailtype = "HTML";
$smtp = new smtp($smtpserver, $smtpserverport, true, $smtpuser, $smtppass);
$smtp->debug = FALSE;
$smtp->sendmail($mailto, $smtpusermail, $mailsubject, $mailbody, $mailtype);