PHP mail() not working

software development

#1

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]

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

[/php]


#2

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


#3

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:
http://www.dreamhoststatus.com/2012/01/02/messages-originating-from-webservers-are-being-delayed/[hr]
Anyone else having this issue?


#4

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.


#5

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!

Jill

[hr]
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.
J


#6

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 );
fclose($fp);  

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’


#7

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


#8

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.


#9

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…


#10

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


#11

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).


#12

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?


#13

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


#14

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


#15

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


#16

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.


#17

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 = “cryptozoic.com
$err = mail(‘me@cox.net’, ‘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


#18

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

iad1-vsguest-relay1.dreamhost.com and mx21.g.dreamhost.com are blacklisted.