Search the Community
Showing results for tags 'smtp'.
-
hi, i tried to send an email through a php code as given in the book but following error occured Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\email.php on line 47 i tried to fix it by trying alot of things searching from internet but can't solve .
-
I'm making a PHP newsletter sender, and I have multiple emails in a database. Is the following code the proper way to send multiple emails? So imagine that I have already done the MySQL call to retrieve all the emails, and I am now here: require_once "Mail.php"; require_once "Mail/mime.php"; $mail = new Mail_Mime(); $mime->setTXTBody('Text email'); $mime->setHTMLBody('HTML email'); $mime->setFrom('Sample Email Sender <sample@email.com>'); $mime->setSubject($subject); $body = $mime->get(); $headers = $mime->headers(); $smtp['host'] = 'smtp.emailserver.com'; $smtp['auth'] = true; $smtp['username'] = 'username@email.com'; $smtp['password'] = 'password'; $mail =& Mail::factory('smtp', $smtp); while($row = @mysqli_fetch_array($rq, MYSQLI_NUM)){$mail->send($row[0], $headers, $body);} unset($mime, $mail); You'll notice that what I did was set all the main email stuff outside of the while{} loop. Is this setup okay? Or do I need to move anything else into the while{} loop? Thanks again.