代码如下:
IsSMTP(); // send via SMTP $mail->Host = "smtp.163.com"; // SMTP servers $mail->SMTPAuth = true; // turn on SMTP authentication $mail->Username = "test123"; // SMTP username 注意:普通邮件认证不需要加 @域名 $mail->Password = "123456"; // SMTP password $mail->From = ""; // 发件人邮箱 $mail->FromName = "脚本学堂"; // 发件人 ,比如 脚本学堂 $mail->CharSet = "GB2312"; // 这里指定字符集! $mail->Encoding = "base64"; $mail->AddAddress($sendto_email,$user_name); // 收件人邮箱和姓名 $mail->AddReplyTo("","脚本学堂"); //$mail->WordWrap = 50; // set word wrap //$mail->AddAttachment("/var/tmp/file.tar.gz"); // attachment 附件1 //$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); //附件2 $mail->IsHTML(true); // send as HTML $mail->Subject = $subject; // 邮件内容 可以直接发送html文件 $mail->Body = <<phpmailer邮件发送测试_脚本学堂_www.jbxue.com