I Use php mailer to send emails. Currently the system sends the e-mail to a user who types in his e-mail and a copy of the same e-mail arrives at the CCN.
I would like to send to the CCN an email with different content and not the same one.
Now my code is this:
require 'PHPMailer_5.2.0/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.smtp.com';
$mail->SMTPAuth = true;
$mail->Username = 'admin@admin.it';
$mail->Password = 'XXXXXX';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('admin@admin.it', 'Name Surname');
$mail->addAddress($_POST['email']);
$mail->AddBCC("info@admin.com");
$mail->isHTML(true);
$mail->Subject = 'Report Questionario PugliaParadise';
$mail->Body = 'This is the body message';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo '<div id="successo-email">Grazie! Il tuo report è stato inviato
correttamente!</div>';
echo '</div>';*/
}
I would like the user info@admin.com to receive an email with a different content in CCN.
Thanks
Clear Recipient and resend again
require 'PHPMailer_5.2.0/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.smtp.com';
$mail->SMTPAuth = true;
$mail->Username = 'admin@admin.it';
$mail->Password = 'XXXXXX';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('admin@admin.it', 'Name Surname');
$mail->addAddress($_POST['email']);
$mail->isHTML(true);
$mail->Subject = 'Report';
$mail->Body = 'This is the body message';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->Send();
$mail->ClearAllRecipients();
$mail->Body = 'This is the body message 2';
$mail->AddAddress("info@admin.com");
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo '<div id="successo-email">Grazie! Il tuo report è stato inviato
correttamente!</div>';
echo '</div>';*/
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.