For those using Gmail as SMTP

My Mautic version is: 4.4.11
My PHP version is: 7.4.33

Hey, for anyone using Gmail as their SMTP, here’s a nice trick I put together to have Mautic recognize the emails and process them:

  1. Create a Label called “Mautic” in my Inbox
  2. Put this little script in a Gmail App Script:
function myFunction() {
  let threads = GmailApp.getInboxThreads();
  var label = GmailApp.getUserLabelByName("Mautic");
  threads.forEach(function(thread, index, threads) {
    let message = thread.getMessages()[0];
    let header = message.getHeader('List-Unsubscribe');

    if (header.includes("")) {
      Logger.log("Thread from mautic: " + thread.getFirstMessageSubject());
  1. Setup my Mautic to fetch emails from the Mautic folder in my inbox.

Now my Mautic is tracking bounces :grinning:


You are appreciated

1 Like