Jump to content

Bouncing Emails


Recommended Posts

1 hour ago, Square Wheels said:

I have no php talents at all.

What I am looking for is something that will remove all email notifications and set the user to not receive notifications from the admin, and move them to a user group of my choosing.

I'd even settle for a query I could run that would do all of that.  I just edit the query with the email address and run it and it updates the needed tables.

Right now, I am doing it manually and it takes forever, I still have over 500 to process and I am avoiding it.

Honestly I don't know exactly everything EmailBouncer does, and whether it meets your requirements (maybe @stoo2000 can answer that), but if it does, the simplified version of my script boils down to this…

<?php

\define('REPORT_EXCEPTIONS', TRUE);
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
require_once 'init.php'; 

header('Content-Encoding: none');
ob_implicit_flush(true);
ob_end_flush();
set_time_limit(60*180);
echo str_repeat(' ',1024*64.1);

$hardfails = array(
     'email1@host5.com',
     'email2@host4.com',
     'email3@host3.com',
     'email4@host2.com',
     'email5@host1.com'
     );
$softfails = array(
     'email6@host0.com',
     'email7@host9.com',
     'email8@host8.com',
     'email9@host7.com',
     'email0@host6.com'
     );

echo '<!DOCTYPE html><html lang="en-US" dir="ltr"><head><meta charset="utf-8"></head><body>';


echo "<p>Please note: 'Email address not found' can mean two things – 1) that you have a problem because a member record could not be found, or 2) that the member has already corrected the problem. If you see just a few messages like that, it usually indicates that the member already corrected the problem.</p>";

echo "</ul><h2>".count($softfails)." Soft Fails</h2><ul>";
asort($softfails);
foreach ($softfails as $fail){
    list($email, $datetime) = explode(',', $fail);
    echo "<li>$email – ";
    ob_flush();

    $member = \IPS\Member::load( $email, 'email' );

    if( $member->member_id ) {
      if ($_GET['test'] != '1'){
        $member->bouncerSoftBounce( $datetime );
      }
        echo "set as soft bounce. ($datetime)";
    } else {
        echo "<b>EMAIL ADDRESS NOT FOUND</b>"; 
    }

    echo "</li>";
    ob_flush();
}
echo "</ul>";

echo "<h2>".count($hardfails)." Hard Fails</h2><ul>";
asort($hardfails);
foreach ($hardfails as $fail){
    list($email, $datetime) = explode(',', $fail);
    echo "<li>$email – ";
    ob_flush();

    $member = \IPS\Member::load( $email, 'email' );

    if( $member->member_id ) {
      if ($_GET['test'] != '1'){
        $member->bouncerHardBounce( $datetime );
      }
        echo "set as hard bounce. ($datetime)";
    } else {
        echo "<b>EMAIL ADDRESS NOT FOUND</b>";
    }

    echo "</li>";
}
echo "</ul>";

echo "</body></html>";

?>

Take that file, save it as something like bouncing.php and then replace the email@host.com stuff in the two arrays with the list of emails you want handled. Make sure the list is  formatted the same way – quotes (or double quotes) around each email address and commas between them. And if you have no hard or soft bounces take out all the examples so it just says array();

After you make those changes, use FTP to put the file in the root directory of your site. Then use this URL:

https://yoursite.com/bouncing.php?test=1

That will run through things and do everything except for actually handing the bounces. If everything looks good, then run the same URL without the ?test=1 and it will actually do the hard and/or soft bounces.

Link to comment
Share on other sites

4 hours ago, jay5r said:

That will run through things and do everything except for actually handing the bounces. If everything looks good, then run the same URL without the ?test=1 and it will actually do the hard and/or soft bounces.

Thank you, by handling the bounces, what do you mean?  Will it move their member group?  Unsubscribe them?

Link to comment
Share on other sites

1 hour ago, Square Wheels said:

Thank you, by handling the bounces, what do you mean?  Will it move their member group?  Unsubscribe them?

It does whatever Mail Bouncer does. Refer to the documentation for that.

Link to comment
Share on other sites

  • 8 months later...
On 5/21/2020 at 1:01 PM, Square Wheels said:

Right now, I am doing it manually and it takes forever, I still have over 500 to process and I am avoiding it.

I can relate to this!

I thought I was just missing something, but right now I don't think there is any in-built way to manage this problem without external applications/scripts, right? 

It would be really great if IPS could introduce a way to halt all future emails to an address once an email bounces, until they re-verify their email address.  

Edited by theipsguy
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...