您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

phpmailer 发送邮件实例代码

2024/5/14 16:06:58发布28次查看
phpmailer 发送邮件实例代码
header(content-type:text/html;charset=utf-8); include('phpmailer/class.phpmailer.php'); include('phpmailer/class.smtp.php'); $mail = new phpmailer(); $mail->issmtp(); // set mailer to use smtp $mail->host = smtp.sohu.com; // smtp服务器 $mail->port = 25; $mail->smtpauth = true; // smtp认证? $mail->username = yourmail@sohu.com; // 用户名 $mail->password = yourmail168; // 密码 $mail->from = spr_zsql@163.com; //发件人地址 $mail->fromname = test; //发件人 $mail->addaddress(yourmail@qq.com, test); //收件人地址,收件人名称 $mail->wordwrap = 50; //$mail->addattachment(/var/tmp/file.tar.gz); // 附件 //$mail->addattachment(/tmp/image.jpg, new.jpg); // 附件,新文件名 $mail->ishtml(true); // html格式 $mail->subject = 测试; $mail->body = 测试; if(!$mail->send()) { echo mailer error: . $mail->errorinfo; echo 发送邮件错误!; }else{ echo 邮件发送成功!; }
永久链接:
转载随意!带上文章地址吧。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product