将电子邮件发送给Receiver时提交并且发件人使用PHPMailer获取提交副本 [英] Get Email To Receiver When Submitted And Also Sender Get Submission Copy using PHPMailer
问题描述
我是PHPMailer图书馆的新手,我想从我的联系表单中获得电子邮件。但是在提交表单时,我希望发件人也收到一封邮件的副本,附加信息为感谢您注册我们。在浏览PHP邮件程序时,我们可以使用 addCC(); 。但如何嵌入额外的味精。
你能帮我解决这个问题吗? 使用CC或BCC将始终导致发送给所有人的相同消息;如果您希望不同收件人的邮件不同,则必须使用不同的主体发送单独的邮件。使用PHPMailer:
$ mail-> addAddress(impaired1@example.com');
$ mail-> Body =hello abc;
$ mail-> send();
$ mail-> clearAddresses();
$ mail-> addAddress(impaired2@example.com');
$ mail-> Body =hello xyz;
$ mail-> send();
调用 clearAddresses
非常重要,否则第二条消息将发送给两个recpients。
I am newbie with PHPMailer library , I want to get emails from my contact form But on submission of form I want sender also get a copy of mail With additional message as " thanks for registering with us." As I gone through PHP mailer examples We can use addCC();. But how to embed additional msg.
Could you please help me with this ?
Using CC or BCC will always result in identical message being sent to all; If you want the messages to be different for different recipients, you must send separate messages with different bodies. With PHPMailer:
$mail->addAddress('recipient1@example.com');
$mail->Body = "hello abc";
$mail->send();
$mail->clearAddresses();
$mail->addAddress('recipient2@example.com');
$mail->Body = "hello xyz";
$mail->send();
It's important to call clearAddresses
as otherwise the second message will be sent to both recpients.
这篇关于将电子邮件发送给Receiver时提交并且发件人使用PHPMailer获取提交副本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!