<新手帖>请问下将表单的数据存入数据库后 怎么给该数据所属的用户发邮件

WBOY
Release: 2016-06-23 13:43:25
Original
1107 people have browsed it


 = - 求大神相助   可以用

<?phprequire("class.phpmailer.php"); //下载的文件必须放在该文件所在目录$mail = new PHPMailer(); //建立邮件发送类$address = $_POST['address'];$mail->IsSMTP(); // 使用SMTP方式发送$mail->CharSet='UTF-8';// 设置邮件的字符编码$mail->Host = "mail.xxxxx.***"; // 您的企业邮局域名$mail->SMTPAuth = true; // 启用SMTP验证功能$mail->Port = "***"; //SMTP端口$mail->Username = ***@xxxx.***; // 邮局用户名(请填写完整的email地址)$mail->Password = "******"; // 邮局密码$mail->From = ***@xxxx.***; //邮件发送者email地址$mail->FromName = "您的名称";$mail->AddAddress("$address", "");//收件人地址,可以替换成任何想要接收邮件的email信箱,格式是AddAddress("收件人email","收件人姓名")//$mail->AddReplyTo("", "");//$mail->AddAttachment("/var/tmp/file.tar.gz"); // 添加附件//$mail->IsHTML(true); // set email format to HTML //是否使用HTML格式$mail->Subject = "PHPMailer测试邮件"; //邮件标题$mail->Body = "Hello,这是测试邮件"; //邮件内容$mail->AltBody = "This is the body in plain text for non-HTML mail clients"; //附加信息,可以省略if(!$mail->Send()){echo "邮件发送失败. <p>";echo "错误原因: " . $mail->ErrorInfo;exit;}echo "邮件发送成功";?>
Copy after login



这个代码吗  , 可以的话如何设置呢 ~  非常感谢 


回复讨论(解决方案)

参考: http://blog.csdn.net/fdipzone/article/details/8683993

   那请问如何将邮件内容设置为数据库的数据发给他呢  = -  谢谢

把数据库内容读出,然后放到$mail->Body = '这里填数据库中读取到的数据'

   就是将数据库的数据调出来的代码写到body后面吗     收邮件的人的邮箱呢  = - 怎么设置
   麻烦了 谢谢

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template