phpjayx Posted November 22, 2012 Share Posted November 22, 2012 Why are my posts getting booted...? I just need help!!! Can someone help me getting multiple emails sent with PHP? I was able to get this to work with 1 recepient at a time, but not multiple. The other code on the forums I have not been able to get to work... can someone help with the below code? Many thanks function sentEmailSMTP2($email1, $email2) { $string2 = $email1. "@hotmail.com" . "," . $email2. "@hotmail.com"; $to = $string2; $from = "me@xxxxxxxxx.com"; $subject = 'messageX'; $message = 'Its ready'; $headers = 'From: me@xxxxxx.com' . "\r\n" . 'Reply-To: me@xxxxxx.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); $host = "mail.xxxxxxx.com"; $username = "me@xxxxxxxx.com"; $password = "password"; $mail = new PHPMailer(); $mail -> IsSMTP(); // telling the class to use SMTP $mail -> SMTPAuth = true; $mail -> SMTPKeepAlive = true; $mail -> Host = $host; $mail -> Username = $username; $mail -> Password = $password; $mail -> SetFrom($from, 'Test '); $mail -> Subject = $subject; $mail -> AddAddress($string2); $mail -> Body = $message; if (!$mail -> Send()) { echo "Mailer Error (" . str_replace("@", "@", $string2) . ') ' . $mail -> ErrorInfo . '<br />'; } else { echo "Message sent to :" . $string2 . ' (' . str_replace("@", "@", $string2) . ')<br />'; } } Link to comment https://forums.phpfreaks.com/topic/271019-php-mailer-to-multiple-addresses-issue/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 22, 2012 Share Posted November 22, 2012 You already have a thread for this, don't start more threads for the same issue. Topic locked... Link to comment https://forums.phpfreaks.com/topic/271019-php-mailer-to-multiple-addresses-issue/#findComment-1394287 Share on other sites More sharing options...
Recommended Posts