mail() return False at 6th email sent

the mail() function

Moderators: macek, egami, gesf

jmttinoco
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Dec 12, 2013 8:43 am

mail() return False at 6th email sent

Postby jmttinoco » Thu Dec 12, 2013 9:28 am

Hi,

I made a little test php script that send a html email to 3 emails addresses. First time i run the script didn´t return any error. i run second time and mail start returning False at second email send. thereafter return every time False.

the code:

Code: Select all

<?php

$lista="lista_teste.txt";

// multiple recipients
try{
   $lines = file ($lista);
   print "tudo bem com lista";
} catch (Exception $e) {
   print "Exceção na lista: ".  $e->getMessage(). "\n";
   exit();
}

// subject
$subject = 'teste';

// message
//$message = "teste";
try{
$message = implode ('', file ('test.html'));
print "<br>tudo bem html";
} catch (Exception $e) {
   print "Exceção na html:".  $e->getMessage(). "\n";
   exit();
}

$headers  = 'MIME-Version: 1.0' . '\n';
$headers .= 'Content-type: text/html; charset=utf-8' . '\n';

// Additional headers
$headers .= 'From: test <info@empresa.pt>'.'\n';
$headers .= 'Reply-To:  <info@empresa.pt>'.'\n';
$headers .= 'Return-Path: <info@empresa.pt>'.'\n';
$headers .= 'Errors-To: <info@empresa.pt>'.'\n';


foreach ($lines as $line_num => $line) {
   $to=$line;
   $enviado=mail($to, $subject, $message, $headers);
   if($enviado)
      echo "<br>".$to;
   else
      print "<br>Erro:<br>";      
}

?>




anyone can help please?

jmttinoco
New php-forum User
New php-forum User
Posts: 2
Joined: Thu Dec 12, 2013 8:43 am

Re: mail() return False at 6th email sent

Postby jmttinoco » Mon Dec 30, 2013 2:44 am

The error has been resolved. was a mistake from the service provider. thanks


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron