Author Topic: Bounce Notifications  (Read 6922 times)

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« on: October 31, 2007, 09:36:12 am »
Hi Dean,

I have a big question here. hope you can help!

I need the following to happen, hopefully possible.

When it reports to the database under the listmail users
table it inserts how many bounces and at what time it happened.

ok, I need a script that will insert into a new table (lm_bouncesrep)
and have it with 3 rows, UID-BRES-STAMP

I need uid, who bounced, BRES why they bounced, and STAMP when they bounced, and if you want BTIME how many times they have bounced.

I can write my own page to output this info, but I need to collect it somehow.

where do I collect, this. I would think in the code where it reads the emails bounced back, and finds the email whom from and tags the lm_users table with who bounced, and when.

I just need to know why!, they bounced. and put that info in a seperate table.

Can you help!,
Thanks,
CB

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #1 on: October 31, 2007, 05:31:22 pm »
If I need to pay for this build on, I am willing. Please PM! me!

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Bounce Notifications
« Reply #2 on: November 01, 2007, 06:34:00 am »
Hi CB,

Have you tried enabling the option 'Notify when a user is removed for bouncing' on the ListMail "List Settings" page?  This feature will send you a notification that includes the bouncing servers' response, where you can find the reason.  Since every server sends different responses, automated processing of these reasons would be a very long and difficult cat and mouse game.  Your best bet is to manually scan the notifications to try to identify things such as serious blocks or typoed email addresses.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #3 on: November 01, 2007, 06:46:05 am »
Quote from: "DW"
Hi CB,

Have you tried enabling the option 'Notify when a user is removed for bouncing' on the ListMail "List Settings" page?  This feature will send you a notification that includes the bouncing servers' response, where you can find the reason.  Since every server sends different responses, automated processing of these reasons would be a very long and difficult cat and mouse game.  Your best bet is to manually scan the notifications to try to identify things such as serious blocks or typoed email addresses.

Regards


Where is this, located in your files. I just don't want to receive that info by email. I want to file it by database. So I would want it to collect, and file instead of collect and mail like it does.

I have used this feature in the past, and do like it for small lists, but when you are mailing out 100,000 or more and get 1000 or more bounces, soft are hard it's a lot of emails to go through.

I would much rather look at a database, or pull a webpage dropping all the data into a CSV or something I can react to other than a email.

Thanks for your help! through this!
CB

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #4 on: November 01, 2007, 08:14:06 am »
Also, the notification by email about the bounces, (as i know) only notifies you when (blank in blank days file as bounced), it only notifies you when they are removed because of bounces.

Not just a notification, that they bounced.

I need to file in the database, every single time it bounces with (ok, the servers response).

Can this be accomplished!, your help is appreciated.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Bounce Notifications
« Reply #5 on: November 01, 2007, 12:59:02 pm »
CB,

Search admin.php for "function bounce".  This function is called every time a user bounces.  You might want to add your code after this line:
Code: [Select]
 while(list($id,$list,$email,$bounces)=mysql_fetch_row($urows)){
Your code, if you add a table to your ListMail DB, might look like this:
Code: [Select]
mysql_query("insert into mybounces values('$id','".addslashes($msg)."','".date("Y-m-d H:i:s)."');");
Note that the same email address can have more than one user ID if it exists on multiple lists.  Note also that we are using the id field and not uid

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #6 on: November 01, 2007, 01:57:02 pm »
I will code something, and post my results. Thanks for your help here.

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #7 on: November 02, 2007, 09:21:41 am »
Is there a way to put this in place to collect the info you have, but to associate the SUBJECT of the message they are bouncing from!, this would help extremly!??

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #8 on: November 03, 2007, 05:43:26 pm »
Quote from: "cwboaze"
Is there a way to put this in place to collect the info you have, but to associate the SUBJECT of the message they are bouncing from!, this would help extremly!??


Is this possible??????

Thanks, a bunch!
CB

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #9 on: November 05, 2007, 07:46:39 am »
Quote from: "DW"
CB,

Search admin.php for "function bounce".  This function is called every time a user bounces.  You might want to add your code after this line:
Code: [Select]
 while(list($id,$list,$email,$bounces)=mysql_fetch_row($urows)){
Your code, if you add a table to your ListMail DB, might look like this:
Code: [Select]
mysql_query("insert into mybounces values('$id','".addslashes($msg)."','".date("Y-m-d H:i:s)."');");
Note that the same email address can have more than one user ID if it exists on multiple lists.  Note also that we are using the id field and not uid

Regards


ok, I got it inserting correctly!, with your code but I had to add a " before the ) inside the date function.

my insert code looks as follows:

Code: [Select]
mysql_query("insert into bouncerow values('$id','".addslashes($msg)."','".date("F j, Y, g:i a")."');");

ok, it works fine. but the message I get is the server response: Here my rest and it's message:

I sent a test message to: jksdlkj@jkldjskldjihuouihdw.com which I knew would fail. it does, and then I run dailymail which runs the query above.

This is way to much, I just need a simple Hardbounce, Softbounce,
or whatever not a Textbook file full of info that must be read through
before it can be determined a hardbounce or softbounce.

This will have to do for now, but can you look into this please. let me know if you require funds to do this.

Where is the $msg collect, I read through and can't find it,
where it collect this info posted above.

Thank You so much, dean.

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Bounce Notifications
« Reply #10 on: November 06, 2007, 01:23:05 am »
The bounce message is passed to the CGI which forwards to bounce.php and then to the bounce function in admin.php

Due to the wide variety of servers there is no way (that I know of) to determine whether a bounce is hard or soft.  The only thing (I think) we can do, besides ListMail actually -becoming- the SMTP server (would never be as efficient with larger lists or might only be for dedicated server), is set up a list of strings and have the classify the message hard or soft.  Such a feature is planned.  Due to time constraints I unfortunately cannot take on any additional custom jobs at this time.

Regards
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #11 on: November 06, 2007, 06:44:06 am »
Quote from: "DW"
The bounce message is passed to the CGI which forwards to bounce.php and then to the bounce function in admin.php

Due to the wide variety of servers there is no way (that I know of) to determine whether a bounce is hard or soft.  The only thing (I think) we can do, besides ListMail actually -becoming- the SMTP server (would never be as efficient with larger lists or might only be for dedicated server), is set up a list of strings and have the classify the message hard or soft.  Such a feature is planned.  Due to time constraints I unfortunately cannot take on any additional custom jobs at this time.

Regards


Darn,

please let me know when you are available!

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #12 on: November 12, 2007, 11:30:15 am »
Dean,

Do you know how to edit the server msg sent back in that.

here's my code to collect that info and spit it into a database. It works, great. now, I need to filter the msg to find the subject and place the user email and info in another table with the subject, and server msg.

Code: [Select]
 $query212 = "select email,fname,lname from lm_users where (id = '$id')";
  $db2382 = "MYDATABASE";
  $result11123 = mysql_db_query($db2382, $query212);
 if($result11123)
      {
         while ($r = mysql_fetch_array($result11123))
        {
           $theirfname = $r["fname"];
  $theirlname = $r["lname"];
  $theiremail = $r["email"];
  }
}
  mysql_query("insert into lm_trackbounces (id,firstname,lastname,emailaddress,msg,date) values('$id','$theirfname','$theirlname','$theiremail','".addslashes($msg)."','".date("F j, Y, g:i a")."');");


This works, great I had to re-write some of your code. , but thanks.

I need to know in reference a few things if you can.

I know how to filter the msg, and find the subject and strip it out, and all that I just need to refresh my programming mind how do you do this for each row in the table lm_trackbounces that everytime I process a row, it deletes it from the database table lm_trackbounces, while I am inserting that data into lm_trackbsub . I just can't get that going.

and next question: how do I alter the msg info that is displayed, from the server, do you know this location in exim, where I can make the subject more identifiable like Subject: "THE SUBJECT" <br> so on

Thanks so much for your help!

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • https://legacy.listmailpro.com
Bounce Notifications
« Reply #13 on: November 13, 2007, 02:06:52 am »
Hey CB,
Quote
I know how to filter the msg, and find the subject and strip it out, and all that I just need to refresh my programming mind how do you do this for each row in the table lm_trackbounces that everytime I process a row, it deletes it from the database table lm_trackbounces, while I am inserting that data into lm_trackbsub . I just can't get that going.

Well if you want to delete "the row you just read" you would use an auto incrementing primary key, read that and use it for the delete query.

My question is: Why two custom tables?  Couldn't you add the parsing into the original script and change the database insert as you desire (lm_trackbsub)?
Quote
how do I alter the msg info that is displayed, from the server, do you know this location in exim, where I can make the subject more identifiable like Subject: "THE SUBJECT" <br> so on

The problem is the message is not from your server - it's returned by the server that rejected your message.  The message should follow the email RFC and contain headers like this:
Code: [Select]
Return-path: return@example.com\r\nSubject: The subject\r\nFrom: "The Sender" <sender@example.com>\r\n
\r\n
Start of message

The \r\n may be \n, so strip out "\r" then do all calculations based on "\n".  Two line breaks or a "line containing only a line break" signifies the start of the message body (bouncing servers' response).
so, in PHP, something like this...
Code: [Select]
// assuming $msg contains the message
$msg=str_replace("\r",'',$msg);
$lines=explode("\n",$msg);
foreach($lines as $line){
 if(!$doneheaders){
  if(substr($line,0,7)=='Subject:') $subject=trim(substr($line,8));
  if($line=="\n") $doneheaders=1;
 } else $outmsg.=$line;
 
}
echo "Subject: $subject<br>Message:<br><textarea rows=20 cols=90>".htmlspecialchars($outmsg)."</textarea><br>";

Note: Untested ;)

Good luck!
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

cwboaze

  • Posts: 37
    • View Profile
Bounce Notifications
« Reply #14 on: November 13, 2007, 08:06:15 am »
Thanks so much for your help!, your post gave me some insight on what to do to make this happen properly. Just needed some help.

As for the table, I may say table but I have only 1 database, with 1 table and new rows. lm_  I alwasy use lm_ on the new ones.

again, thank you for your help!, I will post how it goes and what I done to get it working. Just incase anyone was following this.