Jump to content

php mail() is returning true but emails are not sent. why?


krishna.p

Recommended Posts

Hi Experts,

Iam new to PHP. In my code iam using mail() function to send emails. In almost all the cases the mails are sent successfully. However, in rare cases the emails are not sent though mail() function is returnimg TRUE. I would like to know why this wierd bevior is occuring to some of the emails?

do i need to depend on any other parameter other than mail function's return code like true or false. My remaining part of code depends on mail functions true. for some of these emails it is returning true but no emails are sent. Would appreciate if you could please help me in solving this problem. Thanks in advance.

 

Thanks,

Krishna.p

Link to comment
Share on other sites

Thanks for the quick reply nadeemshafi9. My code sends emails with attachments like pdf files or zip files. In most of the cases the mails are succussfully sent and delivered to all the email addresses present in "to" field as well as "bcc" field. "bcc" contains my mail id. iam able to receive most of emails using my code.

But in some cases, the email is not sent to any of the "to" field addresses or my to my "bcc" address though the mail() is returning true. would appreciate if you could please why this happens? Thanks in advance.

 

Thanks,

krishna.p

Link to comment
Share on other sites

i have looked at all the possibilities. for example lets assume that one thing goes wrong in the above mentioned possibilities in my code. Then mails will not be sent at all. However in my case, most of the mails are sent. but a very little are not sent. Please clarify if iam missing any thing. Any help would be appreciated.

 

Thanks,

krishna.p

Link to comment
Share on other sites

You need to identify what is different about the emails that don't work and track down the point where they are being discarded. You are asking us to tell you what is happening on your mail server and on any number of arbitrarily different receiving mail servers without us having access to that information.

 

Is there something unique about the To: address that don't work (different ISP's check different things, so you might have identical emails except for the domain in the To: address where one ISP will accept it and one won't); Your email server might also have black-listed an ISP so it won't send email to one but it will send to another; Some black-listing is temporary so the symptoms can change over time; Is the body of the mail different (contains spam like words?); Is the size of the attachment different so that it could exceed a mail box limit or a limit for a single email?; are you sending email more frequently than your ISP allows?

 

Short version - you need to determine if your mail server is sending the email or not. If it is not, you need to find out from your host what about the email is causing it to be discarded. If it is being sent and it is being discarded by the receiving mail server, you need to find out from the specific ISP responsible for that mail server for the domain in the To: address why it is being discarded.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.