标签:style blog http color os 使用 io ar for
发送邮件的类:
<?php /** * mail of class * * @author mrlenon */ class Mailer { function sendEmail($address, $name, $subject, $body) { require(‘class.phpmailer.php‘); $mail = new PHPMailer(); //建立邮件发送类 $mail->CharSet = "UTF-8"; //设定邮件编码,默认ISO-8859-1,如果发中文此项必须设置,否则乱码 $mail->IsSMTP(); // 使用SMTP方式发送 $mail->Host = "mail.hostuc.net"; // 您的企业邮局域名 $mail->SMTPAuth = true; // 启用SMTP验证功能 $mail->Username = "xx@xx.com"; // 邮箱用户名(请填写完整的email地址) $mail->Password = "xx"; // 邮箱密码 $mail->Port = 25; //端口 $mail->From = "xx@xx.com"; //邮件发送者email地址 $mail->FromName = "xx"; //发件人名称 $mail->AddAddress($address, $name); //收件人地址,可以替换成任何想要接收邮件的email信箱,格式是AddAddress("收件人email","收件人姓名") //$mail->AddReplyTo("", "");//抄送 //$mail->AddAttachment("/var/tmp/file.tar.gz"); // 添加附件 $mail->IsHTML(true); // set email format to HTML //是否使用HTML格式 $mail->Subject = $subject; //邮件标题 $mail->Body = $body; //邮件内容 //$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //附加信息,可以省略 if ($mail->Send()) { return 1; } else { return 0; } } }
代码下载: http://files.cnblogs.com/MrLenon/mail.rar
标签:style blog http color os 使用 io ar for
原文地址:http://www.cnblogs.com/MrLenon/p/3944659.html