n8n

How to Automate Gmail Mautic Unsubscribe Management?

Make unsubscribe requests hands free. Emails that land in Gmail are matched to contacts in Mautic, removed from newsletters, and marked as do not contact. A friendly confirmation reply is sent back in the same thread.

The flow checks Gmail every minute, even in spam and trash. It reads the To and From fields to spot automated unsubscribe messages. Code steps pull out the sender email and remove duplicates across the thread. Mautic is searched by email, and if the contact exists, the person moves out of the newsletter segment, joins an unsubscribe segment, and is flagged as do not contact. A reply goes back using your custom message so the requester knows it is handled. This keeps lists clean and stops future sends to that contact.

You need Gmail and Mautic with access to segments. Set your email address and your unsubscribe message in the settings node, and align segment IDs with your Mautic setup. Because the trigger runs every minute, requests are handled almost in real time. Expect faster list cleaning, quick confirmation to the user, and fewer mistakes. This fits teams that receive unsubscribe emails in shared inboxes, agencies managing client lists, and operations teams that want clear, compliant updates.

What are the key features?

  • Gmail polling every minute with spam and trash included to catch all requests.
  • Filter logic checks the To and From fields to detect automated unsubscribe messages.
  • Email parsing code extracts the sender address from name and caret formats.
  • Unique email collection removes duplicate updates across the same thread.
  • Mautic contact lookup by email returns the contact ID for precise updates.
  • Conditional path only updates records when a matching contact exists.
  • Moves the person to an unsubscribe segment and removes from the newsletter segment.
  • Marks the person as do not contact to prevent future sends.
  • Sends a Gmail reply in the original thread with your custom message.
  • Central settings node stores your email address and unsubscribe text.

What are the benefits?

  • Reduce manual unsubscribe work from 60 minutes a day to under 5 minutes
  • Handle requests within 1 minute with scheduled checks
  • Eliminate duplicate updates by deduping sender emails
  • Improve list accuracy by up to 90 percent through automatic segment changes
  • Connect Gmail and Mautic without switching tools
  • Support compliance by honoring unsubscribe requests quickly

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with Gmail and Mautic. See the Tools Required section above for links to create accounts with these services.
  3. Open the Gmail Trigger node and in the Credential to connect with field click Create new credential, then follow the on screen steps to connect your Gmail account. Name it clearly, for example Gmail Unsubscribe.
  4. In the Gmail Trigger, confirm include spam and trash is enabled and the poll time is every minute. Save the node.
  5. Open the Edit Fields node and enter your monitored email address and the unsubscribe confirmation message you want to send back.
  6. Open any Mautic node and in the Credential to connect with field click Create new credential. Follow the on screen steps to connect your Mautic account with OAuth2. Use your Mautic base URL, client ID, and client secret. Reuse this same credential for all Mautic nodes.
  7. Set the segment IDs in the Mautic nodes. Replace the unsubscribe segment ID and the newsletter segment ID with your actual IDs. In Mautic you can find the ID by opening a segment and checking the number in the URL.
  8. Review the If filter named Is automated unsubscribe and adjust the conditions if your team uses a different unsubscribe address or subject pattern.
  9. Click Activate to start the workflow. Send a test email from a non list address to your monitored inbox with unsubscribe in the To or subject as you configured.
  10. Check Executions in n8n to confirm the run succeeded. In Mautic confirm the contact is in the unsubscribe segment, removed from the newsletter segment, and marked as do not contact.
  11. Look in Gmail for the automated reply in the same thread. If no reply appears, verify the Reply node uses the correct message and message ID from the trigger.
  12. If the contact is not found, confirm the From address matches the email stored in Mautic. Adjust parsing or filter rules if needed, then retest.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Gmail

Sign up

No cost: Personal Gmail (Gmail API has no usage-based pricing; quotas apply)

Mautic

Sign up

Self-hosted (open source): $0 (API available).

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.