Back

[SOLVED] SMTP not working . . .

  • 0
  • Web
  • Tools
  • Accounts
  • General
  • Self Hosted
Govind
24 Feb, 2023, 05:13

no I ran it on localhost

TL;DR
Issue: SMTP not working Solution: When generating an SSL certificate for a custom domain email (business mail) with appwrite, generate a single SSL certificate for both `domain.com` and `*.domain.com` instead of generating separate SSL certificates for `domain.com` and `mail.domain.com`. This will fix the SMTP error. Explanation: The user encountered an error with the SMTP server when using a custom domain email with appwrite. After testing with a script, it was determined that there was an issue with the appwrite server/SMTP server preventing the connection, possibly due to an SSL certificate problem. It was recommended to generate a
Drake
24 Feb, 2023, 05:14

Would you please try it on the same server that's running Appwrite?

Govind
24 Feb, 2023, 05:14

okay

Govind
24 Feb, 2023, 05:14

BTW this is the program

Govind
24 Feb, 2023, 05:15
Govind
24 Feb, 2023, 05:16

yes it is working

Govind
24 Feb, 2023, 05:16
Govind
24 Feb, 2023, 05:17

I received mail in inbox

Drake
24 Feb, 2023, 05:20

Do you have ssl as the secure env var?

Govind
24 Feb, 2023, 05:22

yes

Govind
24 Feb, 2023, 05:24
Drake
24 Feb, 2023, 05:25

Does docker compose exec appwrite-worker-mails vars show the correct values? Including _APP_SYSTEM_EMAIL_ADDRESS

Govind
24 Feb, 2023, 05:26

all values are correct

Drake
24 Feb, 2023, 05:32

Would you be willing to DM me the exact values you used for the script and the output of the docker compose command?

Govind
24 Feb, 2023, 05:33

including password ?

Drake
24 Feb, 2023, 05:34

You can leave out the password

Govind
24 Feb, 2023, 05:43

you deleted previous message of mine ?

Govind
24 Feb, 2023, 05:43

I shared information in message for you

Drake
24 Feb, 2023, 05:48

I DMed you

Govind
24 Feb, 2023, 05:50

yes

Drake
24 Feb, 2023, 18:30

Circiling back here. After testing with this script:

TypeScript
#!/bin/sh

TO=demo@example.com
if [ ! -z "$1" ]; then
    TO=$1
fi

COMMAND='echo -e "From: <$_APP_SYSTEM_EMAIL_ADDRESS>\nSubject: Test SMTP Connection" | sendmail -H "openssl s_client -quiet -tls1 -connect $_APP_SMTP_HOST:$_APP_SMTP_PORT" -au$_APP_SMTP_USERNAME -ap$_APP_SMTP_PASSWORD -f $_APP_SYSTEM_EMAIL_ADDRESS -v'

COMMAND="${COMMAND} ${TO}"

docker compose exec appwrite-worker-mails sh -c "$COMMAND"

We got something like:

sendmail: send:'NOOP' 140170094533448:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:331: sendmail: helper exited (1)

Based on this, we've determined there's something wrong with the appwrite server/smtp server preventing the connection. Maybe an SSL certificate problem.

Drake
24 Feb, 2023, 18:30

[SOLVED] SMTP not working . . .

Govind
4 Mar, 2023, 19:48

thanks a lot πŸ™‚

Govind
11 Mar, 2023, 06:27

If you are using your custom domain email (business mail) with appwrite then while generating SSL certificate don't generate two separate SSL for domain.com & mail.domain.com

instead generate single SSL for domain.com & *.domain.com and use it for mail.domain.com

Other wise appwrite SMTP won't work and gives error

Govind
11 Mar, 2023, 06:27

This is final solution

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more