phpMailer 发送邮件
来源:程序员人生 发布时间:2014-02-21 16:41:59 阅读次数:3465次
昨天听一网友说用php 里面的mail发邮件发不出去,我想一般都是发不了的,现在大多数据邮件提供商都不准那样了,下面我们就用phpmailer进行了吧,先到tom.com注册一个邮箱吧.
- function smtp_mail ($accept_email,$accept_name,$accept_info) {
- $mail = new PHPMailer();
- $mail->IsSMTP();
- $mail->Host = "smtp.tom.com";
- $mail->SMTPAuth = true;
- $mail->Username = "cs_he";
- $mail->Password = "123456";
- $mail->From = "cs_he@tom.com";
- $mail->FromName = "请查收您签名";
- $mail->CharSet = "GB2312";
- $mail->Encoding = "base64";
- $mail->AddAddress("$accept_email","$accept_name");
- $mail->AddReplyTo("cs_he@tom.com","tom.com");
- $mail->IsHTML(true);
- $mail->Subject = '您好,请查收您签名';
-
- $mail->Body = "$accept_info";
- $mail->AltBody ="text/html";
- $mail->Send();
- }
上面就这简单了.
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠