masgas Posted September 23, 2006 Share Posted September 23, 2006 Hi again!I'm here trying to send some mails to a list from MySQL db, with this class from Richard Hayes and it worked fine for one adress, but when I (of course) tried to do it for more people it gave this error! (I guess it is in the $mai->send(array... somewhere!! But I am not sure! Any ideas!?I get this error message:Warning: mail() [function.mail]: SMTP server response: 501 <$email> Invalid mail address, must have a domain part in C:\xampp\htdocs\soa\htmlMimeMail5\htmlMimeMail5\htmlMimeMail5.php on line 743thanks you...if (Send == $_REQUEST[Send]) { $con=mysql_connect('','','') or die ('no conn serv'); mysql_select_db('mailertest') or die ('no conn db'); $sql = "SELECT * FROM mails WHERE Nivel = '$Nivel'"; $display = mysql_query ($sql) or die ('error'); while ($row = mysql_fetch_array($display)) { $Name = $row["Name"]; $email = $row["email"]; $Surn = $row["Surn"]; require_once('../htmlMimeMail5.php'); $mail = new htmlMimeMail5(); /** * Set the from address */ $mail->setFrom('Masgas <[email protected]>'); /** * Set the subject */ $mail->setSubject('Test email'); /** * Set high priority */ $mail->setPriority('high'); /** * Set the text of the Email */ $mail->setText('Sample text'); /** * Set the HTML of the email */ $mail->setHTML('<b>Sample HTML</b> <img src="background.gif">'); /** * Add an embedded image */ $mail->addEmbeddedImage(new fileEmbeddedImage('background.gif')); /** * Add an attachment */ $mail->addAttachment(new fileAttachment('example.zip')); /** * Send the email */ $mail->send (array('$email')); } } else { echo "something is wrong"; echo $email;}?> Link to comment https://forums.phpfreaks.com/topic/21785-error-sending-mails-from-array/ Share on other sites More sharing options...
yonta Posted September 23, 2006 Share Posted September 23, 2006 Well, since you're sending the emails inside the while, you will only send one email each time and not to the whole list. So you should do this:$mail->send ($email);instead of this:$mail->send (array('$email')); Link to comment https://forums.phpfreaks.com/topic/21785-error-sending-mails-from-array/#findComment-97301 Share on other sites More sharing options...
masgas Posted September 23, 2006 Author Share Posted September 23, 2006 great!you were right about removing the '' from '$email'but with $mail->send(array($email)); worked wonders!!!thanks :) Link to comment https://forums.phpfreaks.com/topic/21785-error-sending-mails-from-array/#findComment-97311 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.