|Reasons why PHP mail might not be working||#1|
I(m using the PHP
function to send email from a contact form. The function returns
so should be fine. But I(m not receiving the email.
I(ve seen posts that say you should always use the From and Reply-To headers in PHP mail to make sure it(s delivered. I(ve tried various configs but nothing is working yet.
Is there any other way to debug the
posted date: 2009-04-13 14:56:00
|Re: Reasons why PHP mail might not be working||#3|
Are you sending the mail from your own computer? You may not have set up a SMTP server that can access beyond your local domain. You may also be blocked by a spam filter, depending on your mail service.If you(re doing this from your own computer, test it by sending a local message to one of your local mail accounts (if you(re using Linux, that is). If you think this is the problem, install postfix.If you(re doing it from a hosting service, check your spam folder.
posted date: 2009-04-13 15:02:00
|Re: Reasons why PHP mail might not be working||#4|
On Unix systems,
, and there are many reasons (permissions, error in configuration) that this might fail. I(m not sure if PHP would detect and report all of these. Check any logs from sendmail.You should also have a look at helpers for sending mail, from PEAR or Zend, for example.
posted date: 2009-04-13 15:04:00
|Re: Reasons why PHP mail might not be working||#5|
If you are on windows you will need to install an SMTP server.If you are on linux you will need to enable sendmail and ensure the user account PHP is installed on has access to the sendmail binary.Ask your host if your account has sufficient permissions to access the binary.Posting your code here might also help in case it is an error in there you overlooked.
posted date: 2009-04-13 15:08:00
|Re: Reasons why PHP mail might not be working||#6|
On some servers you need to explicitely set the FROM header or it wont be sent.
posted date: 2009-04-13 15:10:00
|Re: Reasons why PHP mail might not be working||#7|
Goat, if the server you(re trying the function on is on a dynamic external IP you(re SOL. Most mail servers block incoming connections on port 25 from dynamic IP ranges now. :(
posted date: 2009-04-13 15:11:00
|Re: Reasons why PHP mail might not be working||#8|
I know it(s not specifically answering your question, but my advice would be to use something like swiftmailer instead of mail(). It(s much more reliable, both in terms of getting-it-to-work and getting-the-mail-through.
posted date: 2009-04-13 15:39:00
|Re: Reasons why PHP mail might not be working||#9|
Is it a shared hosting? I know some companies override the mail function to avoid spam, and require additional arguments, or some predefined values (like the from field is required to be a valid address from your domain name). You might want to check with your web hosting company. Do you have a private set up where you could try the same code?
posted date: 2009-04-13 16:08:00
|Re: Reasons why PHP mail might not be working||#10|
How about some code so we can see what you're doing?
posted date: 2009-04-13 16:20:00
|Re: Reasons why PHP mail might not be working||#11|
Most of the time this problem is due to headers, the mail might get send but the SMTP server might never deliver it at all because of faulty headersI(d suggest you to use a mailing class for PHP such as phpMailer which handles all of your problems with headers and has a really nice interface to use cheers
posted date: 2009-04-13 17:55:00
|Re: Reasons why PHP mail might not be working||#12|
Thanks - I found independently that this is what Joomla uses so it can't be too bad. ;)
posted date: 2009-05-05 07:33:00
|select page: « 1 2 »|