• 0

mail() not sending any emails


Question

I have a problem, a huge one actually. I'm using the mail() function to send a email to the admin of a site every time there is a new comment.

I've tried setting the correct headers, exactly like the example at PHP.net but nothing works.

This are my headers:

	$headers .= "MIME-Version: 1.0" . "\r\n";
	$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
	$headers .= "x-mailer: PHP/" . phpversion() . "\r\n"; 
	$headers .= 'From: '.$site_name.' <'.$system_email.'>' . "\r\n";

Anyone willing to help me? Thanks :)

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

make sure that the sendmail service is on on your server, and that the path to it is correct in php.ini

(usually, "/etc/init.d/sendmail start" works )


SMTP = localhost
smtp_port = 25
; NOTE THIS MAY NOT BE YOUR SENDMAIL PATH. PLEASE CHECK.
sendmail_path = "/usr/sbin/sendmail -t -i"

Link to comment
Share on other sites

  • 0

make sure that the sendmail service is on on your server, and that the path to it is correct in php.ini

(usually, "/etc/init.d/sendmail start" works )


SMTP = localhost
smtp_port = 25
; NOTE THIS MAY NOT BE YOUR SENDMAIL PATH. PLEASE CHECK.
sendmail_path = "/usr/sbin/sendmail -t -i"

I've checked that, its working. I've tried out the script on my online server, still the same.

Link to comment
Share on other sites

  • 0

Is this your server or are you hosted through another company? Do you know if they have PHP suEXEC setup? Do they allow sending mail through the user nobody or do they block that?

Link to comment
Share on other sites

  • 0

Is this your server or are you hosted through another company? Do you know if they have PHP suEXEC setup? Do they allow sending mail through the user nobody or do they block that?

I'll find out from them.

But.. when I use this:

$headers .= 'From: '.$site_name.' <'.$system_email.'>' . "\r\n";

It doesn't work but if I use this:

$headers .= 'From: Test <test@test.com>' . "\r\n";

It works

Link to comment
Share on other sites

  • 0

sometimes you have to email it to your servers as well .. e.g.

$to = hostemail.com

.$to = email.com

or

some hosts dont allow emails out unless its a true email ... e.g.

if you say info@website.com .... in the webform as the from but it dosent exsist on your servers... then it maye not send ...

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.