Jump to content

Sending with mail() function problem


steelerman99

Recommended Posts

Hey all!

 

I have a database of users and their email addresses listed.  One page sends each user some information that is unique to them.  So, I have a loop that queries their record from a database, puts their unique information in an email, and sends it out.

 

I can't send a mass email (eg with 100 addresses in the 'To:' header) because each email is different and unique to the user, so I'm calling the mail() function in a loop:

 

(Pseudocode)

 

foreach(record in db)

{

    mail(unique message);

}

 

 

The code works fine, however, some users are not getting the email for one reason or another, even though the mail function executes successfully on EVERY iteration.

 

I suppose their mail servers are considering it spam or something similar.  Is there any way to prevent the messages from being considered spam and making sure they get through to the users?

 

Thanks!!

 

Link to comment
Share on other sites

Also look at your mail logs, it will help you see if your sendmail failed on sending email messages.

 

Another thing you can do is just test your messages to different mail servers that run anti-spam software.  Most of the servers that detect the spam will add that data and the spam score to the emails and then you can see why they thought it was spam.

Link to comment
Share on other sites

Also look at your mail logs, it will help you see if your sendmail failed on sending email messages.

 

Another thing you can do is just test your messages to different mail servers that run anti-spam software.  Most of the servers that detect the spam will add that data and the spam score to the emails and then you can see why they thought it was spam.

 

Thanks.  I do know that all the mail is sending successfully - when the mail function returns true, I print out on the page who the mail was sent to.  I have not seen a failed message print out yet.

 

Is there anything that I could put on the existing message (extra header or what not) that would not make it be flagged as spam?

 

Also, how would I obtain the spam data from the other servers?

Link to comment
Share on other sites

Actually the mail() not returning an error didn't mean it successfully left your server, it just means the command ran correctly.  If there was a problem with the email address, or the mail server the email address was hosted on then you would find those errors in your maillog.  If you're on a *nix look at /var/log/mail.log or something similar. 

 

The main things about not getting caught as spam is keep very few images, a decent amount of text.  As far as testing on an account with anti-spam software, I'm have no good recommendations on that.

 

Sorry.

Link to comment
Share on other sites

Actually the mail() not returning an error didn't mean it successfully left your server, it just means the command ran correctly.  If there was a problem with the email address, or the mail server the email address was hosted on then you would find those errors in your maillog.  If you're on a *nix look at /var/log/mail.log or something similar. 

 

The main things about not getting caught as spam is keep very few images, a decent amount of text.  As far as testing on an account with anti-spam software, I'm have no good recommendations on that.

 

Sorry.

 

I'm using cpanel on bluehost.  How do I access my mail logs?

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.