PHP mail() not working

Hi there. I’ve been trying to send email using PHP’s mail() function. It keeps returning success, but I don’t get the emails. Is this a dream host issue or a me issue? Thanks!


<?php $email = ; $from = ; if(!mail($email, 'Test subject', 'message', 'From: '. $from . "\r\n")) { echo "FAILURE"; } else { echo "SUCCESS"; } ?>


I just wanted to update that it’s working now. I can tell because my inbox was just flooded by 40 emails.

PHP Mail() is not working for me at all. I’ve submitted support ticket, no reply. I had a client tell me that a week ago, she submitted a form and I never got it. Now I’m sitting here wondering how much business I’m losing because PHP mail() isn’t working, or maybe hasn’t been for weeks. C’mon DreamHost support, help me out here!

Apparently this happened in Jan:[hr]
Anyone else having this issue?

Not that exact issue, mine was with cron generated email, same difference tho… mail from the server, eventaully it all came through but some was delayed 24 hours or more. If you haven’t already you might want to have the same text appended to a file in your home directory so that you have the ability to double check that you are receiving all of your emails and/or pinpoint failures.

I am not sure I understand your suggestion, what do you mean “same text appended to a file in your home directory so you can double check”. 24 hours. You know, I could live with that, but my suspicion is that mine might have been broken for the past few weeks. My last email was Feb 24th. Nothing since. I usually get at least one a day. Then a client notified me. I need some kind of failure notification. Any suggestions are welcome!


So DreamHost responded after my third support ticket.

They said there was an configuration error with my VPS, now it’s fixed.

God knows how long I’ve not been getting email now from prospective clients.

Add something like this to your php right before or after the mail() statement using the same variables.

$fp = fopen($mailcopyfile, "a"); 
fputs($fp, $now . $to . $subject . $body );

you would probably want to do the fputs differently to format the file so there are newlines, but this gives you a rough idea…

you would also need to define
$mailcopyfile = ‘path/to/your/mailcopyfile.txt’

Awesome, I’ve got this working. Thank you so much for this. Thank you, thank you, thank you.

I’m having this exact same issue, and same deal with being notified by a client regarding some missing submitted forms. I’ve submitted a support ticket through DH yesterday and I’ve gotten a reply-- They have provided me with a log that shows that email SHOULD be leaving the dreamhost servers, but none of them are arriving at any of the destination email addresses I’ve tried. Still in contact with them today.

I’ll write again once I find something more conclusive.

Did people here get their issues resolved? php mail had been working for me find, until this morning, when it suddenly isn’t working anymore. I’ll put in a trouble ticket…

I’m having an issue with php mail as well.

My problem resolved. I temporarily switched over to using SMTP for all our forms, but later went back to using php mail after they fixed it. The problem was caused by a spam filter on Dreamhost’s end incorrectly preventing emails from leaving the server (some of the words in our forms were causing a false positive maybe).

How did you get this resolved? I’m finding that if I have a specific word in the subject of my emails it is not being sent. Who did you contact about this?

I submitted a support ticket (through Support > Contact Support in the DH control panel).

Could you tell us what word appears to be causing the trouble?

“ultimate” which is rather inconvenient as our business is “Ultimate Kickball”.

I am having problems sending mail when I have certain words in the subject. If I remove the word “Chicks” from the subject, the email is sent successfully. I have a ticket into support explaining this problem. I assume there is some spam filter that is filtering out my emails.

I have this problem now. mail () is returning a 1 but my mail is not reaching the host.
I have a very simple script
$host = “
$err = mail(‘’, ‘Monitoring ‘. $host, $host.’ down’);

This script has worked flawlessly for about a year. It stopped sending mail a few days ago.
$err is being returned as true

It appears that mail() is sending but that several of Dreamhost’s mail relays are blacklisted by Backscatterer, casa-cbl and sorbs-spam and are blacklisted.