Reputation: 3
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 ?
Upvotes: 0
Views: 332
Reputation: 37770
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('[email protected]');
$mail->Body = "hello abc";
$mail->send();
$mail->clearAddresses();
$mail->addAddress('[email protected]');
$mail->Body = "hello xyz";
$mail->send();
It's important to call clearAddresses
as otherwise the second message will be sent to both recpients.
Upvotes: 1