昨天听一网友说用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();
- }
上面就这简单了. |