Documentation request: sending email from n8n
-
Hello,
Thank you for packaging n8n. I've been playing a bit with it and tried to send an email. I'd liked it to be able to send emails like any other application.
This took a bit of fiddling, so I thought to write it up. Also, since it is not obvious how to do it, I would like this to be added to the n8n cloudron documentation so that the next user does not have to do the same research as I had to do.
When setting up the email credentials, an expression is required for each of the fields:
- User:
{{$env["CLOUDRON_MAIL_SMTP_USERNAME"]}}
- Password:
{{$env["CLOUDRON_MAIL_SMTP_PASSWORD"]}}
- Host:
{{$env["CLOUDRON_MAIL_SMTP_SERVER"]}}
- Port:
{{$env["CLOUDRON_MAIL_SMTP_PORT"]}}
- SSL/TLS: disabled
To set an expression, click the gear icon next to the field, and click
Add expression
.Then, in the expression field, paste the expression as listed before. The warning in red can be ignored, this will work fine when executing it.
Then, in a Send Email node, set the From Email field to the following expression:
My App <{{$env["CLOUDRON_MAIL_FROM"]}}>
.This will send an email with the name My App, and the address that is set in the cloudron settings.
Then, if you have set up the To and Subject, when you execute the node, you should get an email.
- User:
-
@thetomester13 Thanks I'm glad I've been of help!
-
Ah good docs. But I think the correct approach to this is to do what @thetomester13 suggested which is to create a mailbox and use those credentials. Ideally, generate "email" password credentials and put it into the app i.e via the Profile view in the App Password section. Generally, the "automated" email setup is really for apps to send notifications, password reset etc.
In fact, I think it's a mistake to have
sendmail
addon in the app package. We should probably remove it. What do you guys think?