History: Email bounce handling
Source of version: 9 (current)
Copy to clipboard
# {{page}} New in ((Tiki25)). Leveraging [https://packagist.org/packages/rambomst/php-bounce-handler|rambomst/php-bounce-handler] and ((Email filters)), handle email bounces in Tiki: add system tracker to hold bounce information, add bounce handler lib, add sieve filters to check for bounces and add to bounce list in ((system trackers)). Initial commit: https://gitlab.com/tikiwiki/tiki/-/merge_requests/1879 ## What is bounce A bounced email, or bounce, is an email message that gets rejected by a mail server. When an email bounces, it has for some reason not reached the intended destination. A bounced email can be either a hard bounce or a soft bounce. A hard bounce means that the email address is permanently unavailable and should not receive electronic mail. A soft bounce is temporary, and may be caused by server outages or a full inbox. Most email service providers will designate soft bounces as a hard bounce after three failed sends. ## How to configure ### Step 1: Configure system tracker holding bounce information Go to [System-Trackers], access it from /tiki-admin.php?page=trackers and check **Email bounces tracker** then: - Choose which tracker will store the bounced emails and statistics. - Choose an email field that stores the email address that bounced. - Choose an email folder field that stores the bounced messages read by Tiki. - Choose a numeric field that stores the total number of soft bounces occured for an email address. - Choose a numeric field that stores the total number of hard bounces occured for an email address. - Choose a checkbox field that stores the blacklist state for an email address - whether Tiki should skip sending emails to that email address or not. {img attId=179 width="800" align="center" desc="click to enlarge" title="System tracker configuration"} {BOX()}Create a tracker with these fields before{BOX} {img attId=181 width="800" align="center" desc="click to enlarge" title="Fields require for bounce system tracker"} ### Step 2: Configure the filter Go to [Webmail], Click on **filters** in settings section then click on **add filter** and set other details of filter: name, priority and test. In the conditions & actions section, Add **is bounce** as a condition and select **type** of condition soft, is not soft, hard, not hard. Then click on add action and pick **add to bounce list** {img attId=180 width="800" align="center" desc="click to enlarge" title="Bounce filter configuration"} ### Step 3: Set up cron job Finally add **php console.php sieve:filters** command to Tiki Scheduler or a cron job When these are configured and condition is met (using https://github.com/rambomst/PHP-Bounce-Handler/) item is created/updated in the bounce tracker, updating soft/hard bounce counts, the email added to the tracker email field (if configured)