Custom Bounce management | Integrate with Mailjet

We use mailjet as our SMTP server. This means that they manage bounces on their own and we do not receive a bounce email.

They do have an Event API though (mailjet api for bounce events ) makes a call to a requested link. I’m thinking of creating a script that would get the info from that call and insert it to our phplist DB.

I figured out I must:

  • Add an entry to ‘phplist_bounce’ and ‘phplist_user_message_bounce’
  • Probably increment the bouncecount in ‘phplist_message’ and ‘phplist_user_user’

The only thing I’m missing is how to make the page=bounces to report correctly the campaign and subscriber. Currently they are shown as “unknown”

I read that it’s probably related to having to enter the whole bounce message in

  • Unfortunately (as mentioned before) we do not receive a bounce message report.
  • I tried making a text file and uploading it via phpmyadmin just to see if it would work. The file contained the following 2 lines:

    X-MessageID: [messageID]
    X-ListMember: [userEmail]

But still they are reported as unknown in page=bounces.

What would be the minimum info that has to go in ‘’ for phpList to recognize the campaign and user?

@alejaaandro You need to set the status column and the comment column (that has the subscriber id) on the bounce table

Hey there Duncan, thanks for the reply…

If I understood the info on the image correctly i must have:

status: bounced list message [messageID] [userID]
comment: bounce count increased

I did this and I manged to get the page=bounces to report the Campaign but the subscriber is sill “unknown”

I realized it might as well be:

status: bounced list message [messageID]
comment: [userID] bounce count increased

Tried this as well but again the user is reported as unknown

Does the header need to have a specific format? I’ve just put there:

recipient: user unknown
X-ListMember: [userEmail]

“bouncecount” not “bounce count”

Damn! That did it!
Thanks :slight_smile:

I’m currently making a script to process CSV data provided by mailjet to process all (well, at least the most recent) bounces and later I’ll try to make a script to respond to mailjet’s event call!

Hi @alejaaandro welcome back to the forum. Sounds like you’re making good progress on integrating phpList with Mailjet - will you share your scripts with the community? I’m sure others would benefit from being able to use Mailjet as a sending engine too!

Hey Sam,

Thanks for the welcome :slight_smile:

I’d be happy to! But there’s a lot of hacking going on! I’ve built my own API to handle some basic functions (like retrieving the id of a subscriber etc) - (going through the plugin route seemed too confusing for me when I first started working with phplist since I was a noob)

I’ve almost finalized the script to process bounce data from a csv exported from mailjet. It’s not pretty (especially the informational output that you get) but it gets the job done.

Having said that, I’m more than happy to provide the code and work with someone if they’re interested in turning it into a plugin OR provide the script + my API and instructions for anyone willing to use it as is!

Awesome! The easiest step would probably be putting your code in a GitHub repository (or two? One for your api and one for the mailjet scripts?), from there others can try it out and ask questions or improve it. What do you think?