Skip to content

[Mod] SMTP bounce mod available

edited June 2021 in Contributions


We have been testing for a few weeks a patch to implement SMTP bounce.
The code available here :
Feel free to use and/or redistribute.

This code consists in two parts:

  • A patch to apply to your sendy install, so the Return-Path can be customized with your bounce mailbox (bounce config must be set in sendy config file)
  • A bounce.php program and helper classes to copy to your sendy install. The bounce.php must be added to your crontab so it can check periodically the bounce mailbox

Do not hesitate to report bugs :)
Mathieu at IRCF.


  • Please, can you clarify why this is needed?

  • Hello,

    You only need this patch if you configured Sendy to use SMTP instead of Amazon SES.

    Sendy currently only implements bounce with Amazon SES : Sendy periodically connects to the Amazon API and collects rejected emails due to permanently invalid addresses (hard bounces) or temporary errors like full mail boxes (soft bounces) and also spam complaints, so that Sendy can update each address status in its database to prevent sending further emails to theses addresses, so you can keep a good reputation and your emails won't be considered as spam.

    But if you configure Sendy to use your own SMTP servers (like we do), then you don't use Amazon SES, and you don't have this feature. This patch covers this feature. The mechanism is the same as Amazon API, except that it uses a bounce mailbox : When you send an email with Sendy, you juste have to configure a "Return-Path" header set with your bounce email address, so each error message will be sent to the bounce mailbox. Sendy periodically connects to this mailbox and collect/parse the error messages and updates each address status.

    Do not hesitate if my explanation is unclear, sorry if my english is bad, I'm french.

  • Great explanation, thanks!

  • This is great. Any issues with Sendy upgrades?

  • I am getting an error when running the patch:

    root@sendy:/var/www/html# patch -p0 < sendy_4_0.patch
    patching file autoresponders.php
    patching file includes/config.php

    patch: **** malformed patch at line 43: diff --git includes/create/send-now.php includes/create/send-now.php

  • Hi, i am facing same issue also not able to figure out where i use retupath id ..

  • please help me to configure it..

  • Hello,
    Sorry for this, I've just fixed the patch.
    Please download the last version here :
    And then apply the patch with : cd /path/to/sendy/ && patch -p1 < sendy_4_0.patch
    Note : Iv'e replaced -p0 by -p1 in the apply patch command line because it's a git patch.
    Let me know if it works for you.

  • edited July 2019

    Appears to work once I ran my patch with this syntax:

    patch -Np1 --ignore-whitespace < sendy_4_0.patch

    Thank you!

  • One other quick note...

    This uses imap to connect to your bounce mailbox so you will need to make sure that is installed.


  • Just curious... how does it handle spam complaints, if at all?

  • I had applied patch. But don't know how to configure return-path ?

  • check this
    I ordered this service and working fine for me.

  • Please update it regularly

  • So Sendy should be automatically removing the Bounced emails from being sent to again. Providing using the Amazon API. Otherwise this is a good option?

  • Hello DoubleOpt,
    This patch allows Sendy to mark bounced emails sent from a SMTP server (other than Amazon SES).
    Marking bounced emails sent with Amazon SES is already handled by default, this feature was just missing for the SMTP method.

  • Hello amanjuman,
    Please do not hesitate to open an issue here : if you find some errors on applying the patch. If you can please precise your sendy version and php version.

  • I just wanted to join in here and help out. So I used the bounce code from this and made
    a per brand bounce. So under the smtp settings I added bounce host, port, user and password
    It seems to be working with no issues. You will have to go into the mysql and add a few columns
    and upload a few files that I modified so that it will send out. I also added a NONE option for the ssl/tls
    as my smtp server doesn't use either.

    I wanted to see about adding it to the github.

    Next would be to add the spam complaints.


  • Hello, @Joes and @IRCF

    Thanks for your help developing this great solution to us. I am not able to receive the bounce information. I made all the adjustments in the database and uploaded the necessary files. The recipient address for the bounces are receiving the messages but Sendy is not showing them. Do you know what can be the problem? I'm using with TLS turned on. Any help will be most welcome. Thanks and kind regards.

  • Does this patch work on sendy 5.2.2? If not, do you have any plans to update it?

  • Sorry for the late response I have updated the files for version 5.2.3 it seems to be working.
    Looking for someone update the bounce files and spam complaints. The bounces works spam complaints still don't.

Sign In or Register to comment.