Connecting n8n to e-mail: SMTP and IMAP

For n8n to send e-mail you use SMTP; to read it, IMAP. Either way n8n signs in to a mailbox like any e-mail program: it needs the server, the port, the full address and the password. The logic is the same for a mailbox with us and for any other provider.

What each credential needs

Item Sending (SMTP) Reading (IMAP)
Server The outgoing mail server of the account. The incoming mail server of the account.
Port and encryption On our mailboxes, 465 with SSL. On our mailboxes, 993 with SSL.
User name The full e-mail address. The full e-mail address.
Password The mailbox password. The mailbox password.

The server name and the right ports for your account are in the connection details cPanel shows for each mailbox. See how to create an e-mail account in cPanel. If the mailbox is with another provider, the details come from their help pages.

Building the workflow

1 Create a mailbox just for n8n, for example automation@asuaempresa.ao. That way you do not put a person’s password inside a workflow, and you can change it without affecting anyone else.
2 Create the credential in n8n with the data from the table. To send, use the e-mail sending node; to read, the IMAP trigger node. The exact names and fields depend on the version: see the official n8n documentation.
3 Test by sending to yourself first. If it arrives, SMTP is fine. If not, check the spam folder and then why your e-mail is not sending or receiving.
4 To read, choose what the trigger picks up (for example only what has not been read yet). Without that rule the workflow handles old messages again.
5 Avoid the loop. If the workflow answers e-mails arriving in the very mailbox it reads, it can end up answering its own replies, or a robot on the other side. Filter by sender and by subject.

When it fails

Error Likely cause
Authentication refused Wrong user name or password. Use the full address, not just the part before the @.
Timed out Wrong port, or the server n8n runs on cannot reach that port. See which ports are open.
Certificate error The server name you typed does not match the certificate. Use the mail server name the account gives you.
Sends but lands in spam SPF, DKIM or DMARC is missing on the domain. See SPF, DKIM and DMARC.
Gmail or another provider refuses the password Some providers require an app-specific password for outside programs. Check their help.
A badly built workflow sends a lot, fast. A loop that fires hundreds of messages can put your domain on spam lists. Test with a few recipients and respect the limits: how to write an e-mail that does not land in spam.
For internal alerts (an order came in, a server stopped) always send to an address of yours and use the subject as a filter. It is easy to sort in the inbox.

Need professional mailboxes on your own domain?

See professional e-mail

SEE ALSO

How to create an e-mail account in cPanel

POP or IMAP: which to choose

Why your e-mail is not sending or receiving

Professional e-mail

RECOMMENDED PRODUCT

Professional e-mail on your domain

Mailboxes in your company name, no adverts, with spam filtering. from 5.940,00 Kz/mo (3-year plan, with coupon)

See plans
  • 0 Users Found This Useful
Was this answer helpful?