Sending email

Can anyone explain why this code successfully sends to some email addresses, but not to others (not even to spam folder) and yet I can successfully send emails directly to the same addresses.

  $headers = 'From: ' . $email_from . "\r\n".'Reply-To: ' . $email_from."\r\n" . 'X-Mailer: PHP/' . phpversion();
  @mail($_SESSION['email_to'], $email_subject, $email_message, $headers);

.

It would be much easier if you were not ignoring errors (@) and if you were using a mailer which actually gave you proper error messages (ie phpmailer). If you don’t have any errors then trying to debug something is just guesswork

A common problem which you appear to be doing is setting the From to some form value instead of the server that is sending the mail.

Sponsor our Newsletter | Privacy Policy | Terms of Service