多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
先附上PHPMailer下载地址:https://github.com/VisionZheng/PHPMailer 使用方法: ```php <?php $rootPath = dirname(__FILE__); require $rootPath.'/PHPMailer/PHPMailerAutoload.php'; $mail = new PHPMailer; // 调试模式,可以看到哪里出现错误 //$mail->SMTPDebug = 3; // Enable verbose debug output $mail->isSMTP(); // Set mailer to use SMTP $mail->Host = 'smtp.aliyun.com'; // Specify main and backup SMTP servers // 是否需要验证 $mail->SMTPAuth = true; // Enable SMTP authentication // 邮件内容编码 $mail->CharSet = 'UTF-8'; $mail->Username = 'vision@aliyun.com'; // SMTP username $mail->Password = '********'; // SMTP password // $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 25; // TCP port to connect to // 设置发件人 $mail->setFrom('visionz@aliyun.com', 'visionz'); // 设置收件人,可以有多个,多个在同样的加 $mail->addAddress('1092161320@qq.com', 'asdfasdfasf'); // Add a recipient // $mail->addAddress('ellen@example.com'); // Name is optional // 回复给哪个邮箱 $mail->addReplyTo('visionz@aliyun.com', 'visionz'); // 抄送给谁 // $mail->addCC('cc@example.com'); // $mail->addBCC('bcc@example.com'); // 附件 // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name // 正文是否有加HTML标签 $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subjectdfdfdfd'; $mail->Body = 'This is the HTML message body <b>in bold!</b>'; // 直接发送HTML文件里的内容 // $mail->msgHTML(file_get_contents($rootPath."/sendmail.html")); // 没有带HTML的内容 // $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } ```