Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Server Side Programming > PHP Programming
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 10-03-2009, 01:44 AM
  #1
BonRouge
Winemaster
 
BonRouge's Avatar
 
Join Date: Aug 2005
Location: Sendai, Japan
Posts: 3,070
iTrader: (0)
BonRouge has a spectacular aura aboutBonRouge has a spectacular aura about
mail not being received by all

Hi there.
I need some help.

I have a mail script that seems to be faulty. I have a form that shows lots of people and their email addresses and we check boxes to choose the people to send the mail to.

When the message is written, it goes to this script below. The script checks who is on the list, sends the message to them and records in another table, who the message was sent to.

It seems that the last couple of times that we've used this some people have not received the emails. I can't find a pattern and because there are lots of people on the list (maybe 200), I can't call and ask everyone if they got the email.

I have a few ideas, but I don't know... Maybe...
  • ... one of the addresses was not an email address, so it failed and the script stopped.
  • ... some of the data being put into the database was odd (maybe unusual characters, which happens sometimes because we have Japanese as well as English input).
  • ...the list was to long and the script timed out.
  • ...there's a mistake in the script.
  • ...my mail is being blocked/filtered by anti-spam stuff (though it is not spam).

Any help would be appreciated.

Cheers.

PHP Code:
if (isset($_POST['mlmessage'])) {
$subject=$_POST['mlsub'];
$message=$_POST['mlmessage'];

$mdate=mktime();
mysql_query("INSERT INTO mlmessage (message,mdate,subject) VALUES ('$message',$mdate,'$subject')");
$ml_id=mysql_result(mysql_query("SELECT id FROM mlmessage WHERE message='$message'"),0);

    
$addresses=array();
    
$q=mysql_query("SELECT email,id FROM students WHERE e1onlist=1");
    while (
$r mysql_fetch_assoc($q)){
    
array_push($addresses,array($r['email'],$r['id']));
    }
    
$q=mysql_query("SELECT email2,id FROM students WHERE e2onlist=1");
    while (
$r mysql_fetch_assoc($q)){
    
array_push($addresses,array($r['email2'],$r['id']));
    }
    
    
$from_email="us@our-site.com";
    
$from_name="us";
    foreach(
$addresses as $address) {
    
$email=$address[0];
    
$stu_id=$address[1];
    
mysql_query("INSERT INTO mlmessage_who (stu_id, message_id, email) VALUES ('$stu_id','$ml_id','$email')");
    
$message=stripslashes($message);
    
sendMail($email$subject$message$from_email$from_name);
    }
        
header("Location: http://$ipaddress/path/index.php?page=maillistmail&mess=sent");

BonRouge is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-03-2009, 04:03 PM
  #2
Vege
Super Deity (Level 18)
 
Join Date: Sep 2004
Location: Finland
Posts: 3,410
iTrader: (0)
Vege is just really niceVege is just really niceVege is just really niceVege is just really nice
Checking logs will tell you the correct error, but 99% of the cases it's because you need to time it out.
mail+smtp usually fails after around 200 messages as (if i remember correctly) it requires a new HELO message to SMTP server.

Cront it and send 100 messages every 5 mins.

Thats what we do in a system that needs to send up to thousands of emails.
Have you logged the sendmail error?

Last edited by Vege : 10-03-2009 at 04:07 PM.
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 12:37 AM
  #3
BonRouge
Winemaster
 
BonRouge's Avatar
 
Join Date: Aug 2005
Location: Sendai, Japan
Posts: 3,070
iTrader: (0)
BonRouge has a spectacular aura aboutBonRouge has a spectacular aura about
Vege,
Thanks for the reply.
I checked the errorlog of that directory and there was no recorded error on the day that email was sent out. (There were many more errors which I'd never checked before, but nothing on that day).
How would I cront this? I'm not familiar with that. I thought maybe you meant 'cron', but ....
Thanks again for the help.
BonRouge is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 06:08 AM
  #4
Vege
Super Deity (Level 18)
 
Join Date: Sep 2004
Location: Finland
Posts: 3,410
iTrader: (0)
Vege is just really niceVege is just really niceVege is just really niceVege is just really nice
Cront is a mystical beast that lives in nevernever land.
Easy mistake to make. Ye, i men't cron.
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 11:26 AM
  #5
BonRouge
Winemaster
 
BonRouge's Avatar
 
Join Date: Aug 2005
Location: Sendai, Japan
Posts: 3,070
iTrader: (0)
BonRouge has a spectacular aura aboutBonRouge has a spectacular aura about
But anyway, how would I cron that? I mean, I use cron to do daily backups and checks on certain things. How would I use cron in this context (sending an email to a changing group of people)?

Thanks for the help.
BonRouge is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-04-2009, 12:33 PM
  #6
Vege
Super Deity (Level 18)
 
Join Date: Sep 2004
Location: Finland
Posts: 3,410
iTrader: (0)
Vege is just really niceVege is just really niceVege is just really niceVege is just really nice
php has a command line version.

Quote:
php -f filename.php
cron that php file to be run every 5 minutes and change the script accordingly.
Vege is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-10-2009, 02:58 PM
  #7
BonRouge
Winemaster
 
BonRouge's Avatar
 
Join Date: Aug 2005
Location: Sendai, Japan
Posts: 3,070
iTrader: (0)
BonRouge has a spectacular aura aboutBonRouge has a spectacular aura about
Vege,
Sorry for not getting back to you sooner. I took your advice. I changed a few things in the script and the database and used cron. I can't say how successful it is yet, because we send out mass emails about once a month, but I'm guessing it'll be good.
Thanks again for your input.
BonRouge is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote

Reply
KEEP TABS
SPONSORS
 
Boxedart
 
 


 
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
  
 
 
 



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 03:55 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.