您好,欢迎访问一九零五行业门户网

用PHPMail类发送邮件

function send_mail ($title,$content,$from,$to,$charset='gbk',$attachment =''){ include '/class/phpmail.class.php'; //百度两下 header('content-type: text/html; charset='.$charset); $mail = new phpmailer(); $mail->charset = $charset; //设置采用gb2312中文编码 $mail->issmtp(); //设置采用smtp方式发送邮件 $mail->host = smtp.qq.com; //设置邮件服务器的地址 $mail->port = 25; //设置邮件服务器的端口,默认为25 $mail->from = $from; //设置发件人的邮箱地址 $mail->fromname = ; //设置发件人的姓名 $mail->smtpauth = true; //设置smtp是否需要密码验证,true表示需要 $mail->username = $from; //设置发送邮件的邮箱 $mail->password = ; //设置邮箱的密码 $mail->subject = $title; //设置邮件的标题 $mail->altbody = text/html; // optional, comment out and test $mail->body = $content; //设置邮件内容 $mail->ishtml(true); //设置内容是否为html类型 $mail->wordwrap = 50; //设置每行的字符数 $mail->addreplyto(10000@qq.com,中国最强音); //设置回复的收件人的地址 $mail->addaddress($to,中国最强音); //设置收件的地址 if ($attachment != '') //设置附件 { $mail->addattachment($attachment, $attachment); } if(!$mail->send()) { return false; } else { return true; }
复制代码
发送邮件, phpmail
其它类似信息

推荐信息