Page 1 of 1

mail() not mailing.

Posted: Mon Apr 27, 2009 10:31 am
by granite
Hello there, dudes!!

Well, I've got a problem: I'm using a form to send emails to a mailbox using mail(), but they're not arriving.

I'm sure that the mailbox exists, and that the function mail() returns true, that is, the e-mail was supposedly sent. Also, if I use my gmail account as addressee, the message arrives normally.

Do you have any idea of why it's not arriving?

Thanks.

Re: mail() not mailing.

Posted: Mon Apr 27, 2009 10:32 am
by Benjamin
Can you post your code please?

Re: mail() not mailing.

Posted: Mon Apr 27, 2009 11:07 am
by granite

Code: Select all

$para     = "sac at bioseiva dot com dot br";
$nome    = $_POST['nome'];
$mensagem  = $_POST['mensagem'];
 
$msg = "Mensagem enviada apartir de $site_cliente \r\n \r\n"; 
$msg.= "Nome:     $nome \r\n";
$msg.= "Endereco: $endereco \r\n";
$msg.= "Telefone: $telefone \r\n";
$msg.= "Celular:  $celular \r\n";
$msg.= "E-mail:   $email \r\n \r\n";
$msg.= "Mensagem: $mensagem \r\n \r\n";
$msg.= "IP:       $ip \r\n";
 
$msg2= "$nome, esta é uma mensagem de resposta automática e não deve ser respondida.\r\n$nome_cliente agradece sua visita ao site $site_cliente. Retornaremos o mais breve possivel.\r\n";
$msg2.= "$nome_cliente\r\n";
$msg2.= "$site_cliente";
 
$headers = "From: $nome <$email>";
$headers2  = "From: $nome_cliente <$para>";
 
if(mail($para,"Talk to Us - $nome",$msg,$headers)){
      @mail($email,"Talk to Us - $nome_cliente",$msg2,$headers2);
      ?>
      <script>
           alert('<?php echo $nome ;?>, your message was sent.');
           location.href='http://www.bioseiva.com.br';
      </script>
      <?php 
}else{ ?>
      <script>
           alert('<?php echo $nome ;?>, sorry, your message could not be sent.');
           location.href='http://www.bioseiva.com.br';
      </script> 
<?php 
} ?>

Re: mail() not mailing.

Posted: Wed Apr 29, 2009 6:32 am
by granite
Anyone?

Re: mail() not mailing.

Posted: Wed Apr 29, 2009 6:42 am
by Sanjay2011
First use this headers content

Code: Select all

 
// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
// Additional headers
$headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
$headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
$headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
 
If same problem after using this code then you have to use smtp. Search with keyword mail smtp you will get result.

Re: mail() not mailing.

Posted: Tue May 12, 2009 12:41 pm
by granite
Hey, thanks you very much.

I had three sites with this problem. Your suggestion helped me to fix two of them. The other one, however, is still not sending the emails.

Alright, I'm gonna goolgle to try to solve this.

Thanks!! :o