Jump to content

sendmail problems mail()


glenelkins

Recommended Posts

hi

 

im getting quite frustrated with this. I setup a linux server with cPanel. Now when a php program sends mail using  the mail() function all the emails go through but end up in the receivers spam/bulk email folders.

 

Any ideas why its doing that? Even if i do ini_set ( 'sendmail_from', '[email protected]' ) in the php and setup the headers correctly From: [email protected]  it still goes into the spam!

Link to comment
https://forums.phpfreaks.com/topic/158577-sendmail-problems-mail/
Share on other sites

hi

 

no it does it for every domain it sends an email from.

 

say i have the website setup up www.joeblogs.com, i would code something like:

 

$headers = "From:[email protected]\n";
$headers .= "Content-type:text/html\n";
$att = "[email protected]\n";

ini_set ( "sendmail_from", "[email protected]" );

mail ( "[email protected]", "Test", "BODY", $headers, $att );

 

hi

 

i am almost 100% positive this is something to do with the server setup for sendmail. Does anyone know how i can change the "sender" that the mail() function uses ?? Rather than it being something like nobody@localhost  ill change it to a real domain

No, its just your headers. You certainly do not need this:

ini_set ( "sendmail_from", "[email protected]" );

 

Here:

<?php

$name 	  = "Joe Bloggs";
$from	  = "[email protected]";
$to	  = "[email protected]";

$headers  = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain;\r\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: \"".$name."\" <".$from.">\n";
$headers .= "Reply-To: \"".$name."\" <".$from.">\n";

$subject  = "Test Message";
$mail	  = "This is the email body\n";

mail($to, $subject, $mail, $headers, "-f".$from);

?>

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.