Here is the primary code.
And all the variables are properly established.
$email_to : one legitimate address
$email_subject : basic text
$email_message : also basic text, with minimal html tags.
The code looks fine and all, and I agree with everyone else that the @ shouldn’t make a difference one way or another. To that end, without knowing what the exact error message you were getting, it is hard to diagnose the issue at hand.
Other items that would be nice to see is your [mail function] setup in your php.ini.
If you could provide both of those, that would be helpful (you can skip any smtp username and password, we don’t need to know that).
What would cause the mail to disappear (not be sent) but not generate an error message?
And I have tried different recipient addresses, different subject lines, and plain text message body without success.
Ah, chances are you do not have send_mail setup properly. And it is sitting in a queue on your linux machine. I’ve used mutt in the past to look at the queue, but there is another command … oh yeah, mail
Did you test your sendmail configuration from the command line to make sure you could send e-mails before trying to use PHP?
Did you restart apache after updating the php.ini to use sendmail?
This page, along with 43 others that I work on is hosted at GoDaddy, and their technical support is unable to identify any issues with the hosting setup, the PHP installation, or the page code.
All the tests I can perform seem to indicate there is no problem, and the queue is empty.
I’ve tried your code on my linux server and it works perfectly with or without the @symbol - strange thing is, if I run the identical code on my windows/iis server, I see almost the same results as you do on linux.
with the error suppressed, the page loads cleanly, but no mail is received. If I remove the suppression I get the following error:
Warning: mail() [function.mail]: SMTP server response: 530 SMTP authentication is required
I get this error with genuine and fake from addresses.
Could it be that you too have authentication issues but the error isn’t showing for some reason?
Just thought of something, although it doesn’t explain why @ works and without @ doesn’t. One of the hosts I just recently worked with would only allow mail() to work if you provided an additional parameter of ‘-f<from_email_address_here>’.
2ndmouse: That is interesting. I know the GoDaddy mail servers require SMTP authentication, but I always associated that with using external POP programs like Thunderbird.
It’s entirely possible I have authentication issues but the error isn’t showing. Armed with this idea I’ll contact their tech support again.
I will also try providing the additional parameter of “From.” Although, I would be surprised if this made a difference, as that parameter is already supplied in the header. And the From address I supply in the header does change the reported source in the received message.
Believe it or not, I had to provide both, as the headers are not considered by sendmail in verifying outbound e-mails, but the additional parameter is specific to sendmail and tells it, it is okay (some hosts are setup this way, others are not, just wanted to relay my experience).
If you get this error is because your mail server needs authetication. This is a configuration issue or you’ll need to add the sender’s mail username and password to verify that he’s sending the e-mail to the script