Jump to content

PHP Mail Headers are the suck!


DarkNSF

Recommended Posts

so far this seems to send to my catch-all account, but it blocks it EVERYWHERE else (yahoo, gmail); it doesn't even put it in the spam folder. I've tried 30x combinations and I can't seem to get the header information correct.. It's driving me insane!

 

 

Can anyone shed some light on the problem?

 

http://www.Valhalla-Studios.com/contact.php

 

  // send mail function
  function core_mail($toaddress, $toname, $fromaddress, $fromname, $emailsubject, $msg)
  {
    $headers = "To: ".$toname." <".$toaddress.">\r\n";
    $headers = "From: ".$fromname." <".$fromaddress.">\r\n";
    $headers .= "Reply-To: ".$fromname." <".$fromaddress.">\r\n";
    $headers .= "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html;charset=ISO-8859-9\r\n";
  /*
    $headers  = "";
    $headers .= "X-Sender:  ".$fromname." <".$fromaddress.">\n";
    $headers .= "From: ".$fromname." <".$fromaddress.">\n";
    $headers .= "Reply-To: ".$fromname." <".$fromaddress.">\n";
    $headers .= "Date: ".date("r")."thom@".$_SERVER['SERVER_NAME'].">\n";
    $headers .= "Message-ID: ".date("YmdHis")."";
    $headers .= "X-Mailer: PHP v".phpversion()." on ".$_SERVER['SERVER_NAME']."\n";
    $headers .= "Return-Path: ".$fromname." <".$fromaddress.">\n";
    $headers .= "Delivered-to: ".$fromname." <".$fromaddress.">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html;charset=ISO-8859-9\n";
    $headers .= "Importance: High\n";
    $headers .= "X-MSMail-Priority: High\n";
    */

    mail($toaddress, $emailsubject, $msg, $headers);
  }

Link to comment
https://forums.phpfreaks.com/topic/43778-php-mail-headers-are-the-suck/
Share on other sites

    $headers = "MIME-Version: 1.0" ."\r\n";

    $headers .= "Content-type: text/html;charset=ISO-8859-9" ."\r\n";

 

    $headers .= "To: $toname <$toaddress>" ."\r\n";

    $headers .= "From: $fromname <$fromaddress>" ."\r\n";

 

 

2 things, you are missing a . with one of your = signs and your mail page definitions should go at the top (content type etc..) You don't really need a reply-to either, you have a From header.

thanks, that first error didn't affect anything because to is set in the mail(), however, it should still be fixed.

 

Still not getting mail to yahoo..

 

 

  // send mail function
  function core_mail($toaddress, $toname, $fromaddress, $fromname, $emailsubject, $msg)
  {
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html;charset=ISO-8859-9\r\n";
    $headers .= "To: ".$toname." <".$toaddress.">\r\n";
    $headers .= "From: ".$fromname." <".$fromaddress.">\r\n";
  /*
    $headers  = "";
    $headers .= "X-Sender:  ".$fromname." <".$fromaddress.">\n";
    $headers .= "From: ".$fromname." <".$fromaddress.">\n";
    $headers .= "Reply-To: ".$fromname." <".$fromaddress.">\n";
    $headers .= "Date: ".date("r")."thom@".$_SERVER['SERVER_NAME'].">\n";
    $headers .= "Message-ID: ".date("YmdHis")."";
    $headers .= "X-Mailer: PHP v".phpversion()." on ".$_SERVER['SERVER_NAME']."\n";
    $headers .= "Return-Path: ".$fromname." <".$fromaddress.">\n";
    $headers .= "Delivered-to: ".$fromname." <".$fromaddress.">\n";
    $headers .= "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html;charset=ISO-8859-9\n";
    $headers .= "Importance: High\n";
    $headers .= "X-MSMail-Priority: High\n";
    */

    mail('', $emailsubject, $msg, $headers);

  }

thanks Ken,

 

this hasn't fixed my problem.

 

 

but i've also been looking into this: http://phpmailer.sourceforge.net

and i like it...

 

 

I can send message to the local email account, but anywhere else they don't even appear in spam or anything... I think it's an issue with my ISP. Has anyone else had an issue similar?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.