Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong SMTP configuration #105

Open
openforfuture opened this issue Sep 7, 2024 · 1 comment
Open

wrong SMTP configuration #105

openforfuture opened this issue Sep 7, 2024 · 1 comment

Comments

@openforfuture
Copy link

When trying to send recovery emails, N8N fails with an error related to SSL/TLS certificates. The issue is that the SMTP server's certificate does not include 127.0.0.1 or localhost as an alternate name, which causes the email sending process to fail.

Sep 7 17:36:26 [hostname] postfix/smtpd[XXXX]: connect from localhost[127.0.0.1]
Sep 7 17:36:26 [hostname] postfix/smtpd[XXXX]: SSL_accept error from localhost[127.0.0.1]: lost connection
Sep 7 17:36:26 [hostname] postfix/smtpd[XXXX]: lost connection after STARTTLS from localhost[127.0.0.1]
Sep 7 17:36:26 [hostname] postfix/smtpd[XXXX]: disconnect from localhost[127.0.0.1] ehlo=1 starttls=0/1 commands=1/2
Sep 7 17:36:26 [hostname] n8n[XXXX]: Error: Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:[domain1], DNS:[domain2], DNS:[domain3]
Sep 7 17:36:26 [hostname] n8n[XXXX]: Failed to send email
Sep 7 17:36:26 [hostname] n8n[XXXX]: InternalServerError: Please contact your administrator: Hostname/IP does not match certificate's altnames: Host: localhost. is not in the cert's altnames: DNS:[domain1], DNS:[domain2], DNS:[domain3]

I fixed the issue modifying the n8n config (sudo nano /var/www/n8n/.env) with the actual domain. I also had to remove N8N generated user and pass since auth seems not working. It's not deal that YNH has SMTP without auth but I discover that is like that by default, or at least this is my situation.

N8N_EMAIL_MODE=smtp
N8N_SMTP_HOST=mydomain.tld
N8N_SMTP_PORT=25
N8N_SMTP_USER=
N8N_SMTP_PASS=
N8N_SMTP_SENDER=[email protected]
N8N_SMTP_SSL=false

At least now sending emails works but I hope somebody can improve the situation (general and mine).

@CodeShakingSheep
Copy link
Member

CodeShakingSheep commented Sep 19, 2024

Thanks for reporting this. Could reproduce this issue. However, setting n8n domain as SMTP host didn't work either for me. I got the same error .

Setting SMTP_HOST to n8n domain

Error: Hostname/IP does not match certificate's altnames: Host: <N8N_SUBDOMAIN>.<DOMAIN>.com. is not in the cert's altnames: DNS:<YNH_MAIN_SUBDOMAIN>.<DOMAIN>.com

So, the only solution working for me was to set SMTP_HOST to my main YNH domain.

Setting SMTP_HOST to YNH main domain

Error: Invalid login: 535 5.7.8 Error: authentication failed: (reason unavailable)

Setting SMTP_HOST to YNH main domain without SMTP user and password

Error: Can't send mail - all recipients were rejected: 553 5.7.1 <n8n@<N8N_SUBDOMAIN>.<DOMAIN>.com>: Sender address rejected: not logged in

Setting SMTP_HOST to YNH main domain with SMTP user and password set to YNH main user credentials

Sep 19 19:25:17 n8n[2542425]: Error: Can't send mail - all recipients were rejected: 553 5.7.1 <n8n@<N8N_SUBDOMAIN>.<DOMAIN>.com>: Sender address rejected: not owned by user <YNH_ADMIN_USER>
Sep 19 19:25:17 n8n[2542425]: Failed to send email
Sep 19 19:25:17 n8n[2542425]: InternalServerError: Please contact your administrator: Can't send mail - all recipients were rejected: 553 5.7.1 <n8n@<N8N_SUBDOMAIN>.<DOMAIN>.com>: Sender address rejected: not owned by user <YNH_ADMIN_USER>

Same error for N8N_SMTP_SENDER=n8n@<YNH_MAIN_SUBDOMAIN>.<DOMAIN>.com

Setting SMTP_HOST to YNH main domain with SMTP user and password set to YNH main user credentials and sender to YNH admin user mail

This is the only way it works for me. I'll attempt to make the n8n domain work for mails on my server and then create a PR with a fix.

@CodeShakingSheep CodeShakingSheep mentioned this issue Sep 29, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants