PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old June 15th, 2006, 03:59 AM
jhertum jhertum is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 1 jhertum User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
mail_queue problem

Hi
I wrote a mailer to send newsletters using MAIL_QUEUE. Actually; with all my testings it worked fine. I put hundreds of HTML-mails in the mail queue database using mail_queue->put(...)

Now I wanted to send a newsletter to over 5000 people and it doesn't work. It first sends the mail without problems to several people and then it starts sending wrong information to sendmail; while the information in the mails is nearly the same. I use an MD5 hashed key for people to unsubscribe.

The error I got is:
------------>
sendmail: fatal: Recipient addresses must be specified on the command line or via the -t option
postdrop: warning: stdin: unexpected EOF in data, record type 78 length 71
postdrop: fatal: uid=0: malformed input

Notice: Error in sending mail: sendmail returned error code 64 in /usr/share/php/PEAR.php on line 846
------------->
So if I send the same newsletter to a small amount of people; there is no problem. And to a big amount... it goes wrong.

I looked into the database; did variable dumps etc. But I can't find it. I have the database with mails that didn't go out.

Anybody has a clue how I can debug this? I'm looking into this for days.

detail: I call this programm command line; using crontab

php Code:
Original - php Code
  1.  
  2.  
  3. ... deleted some init stuff
  4.  
  5. $newsletter_id = 0;
  6. $newsletterData = array();
  7. // maillijst = array with mail information
  8. foreach ($maillijstData as $maillijst) {
  9.  
  10.         // if a new newsletter is in the list
  11.     if ($maillijst['newsletter_id']  <> $newsletter_id) {
  12.         $newsletterData = $xdbHandler->getNewsletter($maillijst['customer_id'], $maillijst['newsletter_id']);
  13.         $newsletter_id = $newsletterData[0]['newsletter_id'];
  14.         // do some newsletter things once
  15.         $newsletterData[0]['html_version'] = lib::genereerHeader($newsletterData[0]['html_version']);
  16.         // opschonen newsletter xms tags
  17.         $newsletterData[0]['html_version'] = str_replace('<xms:template>','',$newsletterData[0]['html_version']);
  18.         $newsletterData[0]['html_version'] = str_replace('<xms:/template>','',$newsletterData[0]['html_version']);
  19.         $newsletterData[0]['html_version'] = str_replace('<xms:body>','',$newsletterData[0]['html_version']);
  20.         $newsletterData[0]['html_version'] = str_replace('<xms:/body>','',$newsletterData[0]['html_version']);
  21.         $newsletterData[0]['html_version'] = str_replace('<xms:text>','',$newsletterData[0]['html_version']);
  22.         $newsletterData[0]['html_version'] = str_replace('<xms:/text>','',$newsletterData[0]['html_version']);
  23.         $newsletterData[0]['html_version'] = str_replace('<xms:image>','',$newsletterData[0]['html_version']);
  24.         $newsletterData[0]['html_version'] = str_replace('<xms:/image>','',$newsletterData[0]['html_version']);
  25.        
  26.     }
  27.  
  28.     $from = $maillijst['from_name'].' <'.$maillijst['from_email'].'>';
  29.     $to = $maillijst['firstname'].' '. $maillijst['prefixlastname'] . ' ' . $maillijst['lastname'] . '<'.$maillijst['email'].'>';
  30.  
  31.     #$from = $maillijst['from_email'];
  32.     #$to = $maillijst['email'];
  33.     $subject = $newsletterData[0]['subject'];
  34.    
  35.     $hdrs = array( 'From'    => $from,
  36.                    'To'      => $to,
  37.                    'Subject' => $subject )
  38.  
  39.     $xdbHandler->setNewsletterListSendDate($maillijst);
  40.     $crlf = "n";
  41.     $mime =& new Mail_mime($crlf);
  42.    
  43.     if (strlen($newsletterData[0]['text_version']) > 0) {
  44.    
  45.         $mime->setTXTBody($newsletterData[0]['text_version']);
  46.     }
  47.     if (strlen($newsletterData[0]['html_version']) > 0) {
  48.  
  49.         $html_bericht = $newsletterData[0]['html_version'];
  50.         // converteer mailing
  51.    
  52.         $html_bericht = str_replace('[unique_user]', $maillijst['unique_id'], $html_bericht);   
  53.         $html_bericht = str_replace('[firstname]', $maillijst['firstname'], $html_bericht);
  54.         $html_bericht = str_replace('[prefixlastname]', $maillijst['prefixlastname'], $html_bericht);
  55.         $html_bericht = str_replace('[lastname]', $maillijst['lastname'], $html_bericht);
  56.         $html_bericht = str_replace('[email]', $maillijst['email'], $html_bericht);
  57.         $html_bericht = str_replace('[from_name]', $maillijst['from_name'], $html_bericht);
  58.         $html_bericht = str_replace('[from_email]', $maillijst['from_email'], $html_bericht);
  59.  
  60.         switch ($maillijst['gender']) {
  61.             case 'm' : $aanhef = ' heer '; break;
  62.             case 'f' : $aanhef = ' mevrouw '; break;
  63.             default  : $aanhef = ' heer / mevrouw '; break;
  64.         }
  65.         $html_bericht = str_replace('[aanhef]', $aanhef, $html_bericht);
  66.         $html_bericht = str_ireplace('[euro]','&euro;',$html_bericht);
  67.        
  68.         $mime->setHTMLBody($html_bericht);
  69.     }
  70.    
  71.     $body = $mime->get();
  72.     $hdrs = $mime->headers($hdrs);
  73.    
  74.     /* Put message to queue */
  75.     $mail_queue->put( $from, $to, $hdrs, $body );      
  76.  
  77. }
  78.  
  79.  
  80.  
  81.  
  82.  
  83. /* How many mails could we send each time the script is called */
  84. $max_amount_mails = 50;
  85.  
  86. /* we use the db_options and mail_options from the config again  */
  87. #$mail_queue =& new Mail_Queue($db_options, $mail_options);
  88.  
  89. /* really sending the messages */
  90. $mail_queue->sendMailsInQueue($max_amount_mails);
  91.  
  92. // end of programm
  93.  


This programm is called every minute. So at one time $maillijst is full of information... and all the other time not.
So it fills up the mail_queue... and then starts sending 50 mails at a time.


Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > mail_queue problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway