💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
PHPMailer在GitHub的开源代码 https://github.com/PHPMailer/PHPMailer 如果在Gmail上进行接收email,需要开启“低安全性应用程式存取权”,链接: https://myaccount.google.com/u/0/lesssecureapps?rfn=27&amp;rfnc=1&amp;eid=-8682605152577733367&amp;et=1&amp;asae=2&amp;anexp=gpsv2-control&amp;pli=1 如图: <img class="alignnone size-medium" src="http://yuan.network/wp-content/uploads/2018/08/20180819225808.png" alt="" width="100%" /> html页面: ~~~ <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <form method="post" action="send_mail.php"> Your Email : <input type="text" name="mail_to"> <br/> Subject : <input type="text" name="mail_sub"> <br/> Message <input type="text" name="mail_msg"> <br/> <input type="submit" value="Send Email"> </form> </body> </html> ~~~ 代码: ~~~ <?php $mailto = $_POST['mail_to']; $mailSub = $_POST['mail_sub']; $mailMsg = $_POST['mail_msg']; require 'PHPMailer-master/PHPMailerAutoload.php'; $mail = new PHPMailer(); $mail ->IsSmtp(); $mail ->SMTPDebug = 0; $mail ->SMTPAuth = true; $mail ->SMTPSecure = 'ssl'; $mail ->Host = "smtp.gmail.com"; $mail ->Port = 465; // or 587 $mail ->IsHTML(true); $mail ->Username = "email@gmail.com"; //1.填写email账号 $mail ->Password = "password"; //2.填写email密码 $mail ->SetFrom("email@gmail.com"); //3.填写发送email地址 $mail ->Subject = $mailSub; $mail ->Body = $mailMsg; $mail ->AddAddress($mailto); if(!$mail->Send()) { echo "Mail Not Sent"; } else { echo "Mail Sent"; } ~~~ 源码下载: 链接:https://pan.baidu.com/s/15HvK15c89W4nvBzvf-fGWQ 密码:f700 </pre>