1. Home
  2. Common issues
  3. Seems that bounces aren’t processed, what can i do?

Seems that bounces aren’t processed, what can i do?

So, you’ve sent a campaign and expect to get some bounces back because you intentionally put invalid emails there but nothing shows in the bounces area of the campaign and you are stumped because of that (that makes two of us) and of course you need to know why.

When a bounce server is being used to process bounces, its status changes from active to “cron-running” in your mailwizz web interface.

Mailwizz relies on pcntl extension to make sure if the process doesn’t exit nicely (because of some error or timeout) to restore the initial status of the server, that is, the active status so that the server can be selected next time when the cron job will run.

The thing is, the pcntl extension is something that doesn’t come with php and has to be installed separately so most of the time is likely that your php install doesn’t contain the extension. And because the extension is missing, mailwizz might not be able to restore a proper state of the bounce server (mailwizz has fallbacks mechanisms to cope with missing pcntl extension) and your bounce server will remain stuck in cron-processing mode and will not be picked for processing next time when the cron runs, remember, only bounce server having the status active are picked up for processing.
Bottom line, if you see your bounce server has the status “cron-running” for more than 30 minutes, then you can go to your applicaction

Backend -> Miscellaneous -> Emergency Actions and reset your bounce servers status so that they become active again.

Another thing is that, when processing bounces, mailwizz uses php’s imap extension and even if your web instance of php contains the imap extension that doesn’t mean your command line (CLI) contains it too, matter a fact, i saw multiple servers that use php 5.3 as the web module(well, yeah php-fpm too, but you get the point), and php 5.2 as the CLI module.

You can verify this from command line, by running the command

php -v

which will tell you the version you are using in command line and if that is indeed using the CLI module and not the web module, because, i also saw the command line calling the web module, which is wrong since the web module is subject to timeouts and the such while the command line module isn’t (well, it shouldn’t anyway) thus is perfect for long running scripts.

To make sure your command line php contains the imap extension and the functions, the best way would be to create a php file on your server, say imap.php with the following contents:

PHP:
<?php var_dump(function_exists('imap_open'));?>

then run in from command line with:

php imap.php

If the output contains the false word, then you don’t have imap installed and you have too.

If all the above look fine on your server, then make sure you don’t use services like gmail / yahoo / aol / etc as bounce servers. These services will limit the number of connections and might as well deny access to read the bounce boxes thus mailwizz won’t be able to connect and read the emails.

Next, it’s always a good way to actually login for the bounce box and verify if there are emails there and if there are, and those are returned for your mailwizz campaigns, look in the email source and make sure the following headers are there:

Code:
X-Mw-Campaign-Uid: 13CharsHash
X-Mw-Subscriber-Uid: 13CharsHash

Because mailwizz uses those two headers to identify the campaign and the subscriber so that it can take proper actions against them.
If you don’t see those headers, then that’s bad, somehow those were stripped by the server that returned those emails into your bounce box, nothing much to do in this case.

Other things you can do, since the cron job for processing bounces is a simple command line script, you can actually call it from the command line as:

Code:
php {FULL_PATH_TO_APPS_FOLDER}/apps/console/console.php bounce-handler

and see how that goes, if it processes any bounce from your bounce box.

Some notes:
1. Because of the nature of processing bounces, because each email has to go through thousand of bounce rules and because connecting to imap/pop3 server is usually a slow action (like any other network action) you should make sure your command line php has enough memory to process your bounces. This, in tandem with the settings for bounces from Backend -> Settings -> Cron should be tweaked to match your server.

2) In mailwizz, services like Amazon SES, Mandrill, Mailgun, Leadersend, ElasticEmail, Sendgrid not only work by using their smtp inteface, but they do have custom API implementation in mailwizz and when you create a delivery server, you can use the API implementation instead of the smtp implementation:

mailwizz-web-apis
The reason why you should use these instead of the SMTP alternative is because they are slightly faster when sending and because you don’t need bounce servers at all because mailwizz will subscribe to certain webhooks and will receive notifications when an email bounces, marks you as spam, etc so you don’t need the memory intensive cron job to process bounces.
Please note that mailwizz will connect to the given email provider and will create a webhook where the email provider will send data. The webhook is a url back to your mailwizz application, something like https://www.mailwizz-domain.com/index.php/dswh/X where X is the ID of your delivery server. This means that you don’t have to block incoming requests to these urls.
Each of these providers have their own area where they shown you which webhooks have been created and what events they will receive. Always make sure you check these areas to be sure the webhooks are created and the right events will be sent and of course see the history of the events they have sent in order to see if they actually have sent any info to your webhook url or not.

Was this article helpful?

Related Articles