Hello, I am trying to get sending e-mails through appwrite to work, however each time an e-mail is supposedly sent, it doesn't actually get sent. The worker-mails
container logs return the following:
...has failed Exception: Error sending mail: SMTP Error: Could not connect to SMTP host. in /usr/src/code/app/workers/mails.php:68
Stack trace:
#0 /usr/src/code/src/Appwrite/Resque/Worker.php(122): MailsV1->run()
#1 /usr/src/code/vendor/resque/php-resque/lib/Resque/Job.php(201): Appwrite\Resque\Worker->perform()
#2 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(303): Resque_Job->perform()
#3 /usr/src/code/vendor/resque/php-resque/lib/Resque/Worker.php(242): Resque_Worker->perform(Object(Resque_Job))
#4 /usr/src/code/vendor/resque/php-resque/bin/resque(185): Resque_Worker->work('1', false)
#5 {main}
I have tried two different external SMTP services, one which we use for mails (seznam.cz) and now Sendgrid and I am 100% sure that the credentials are correct. My VPS provider should not be blocking them, because I can succesfully telnet to them both.
When I tried to run appwrite doctor
, each time it would hang for a few minutes on the SMTP
step, however here is the output:
__ ____ ____ _ _ ____ __ ____ ____ __ __
/ _\ ( _ \( _ \/ )( \( _ \( )(_ _)( __) ( )/ \
/ \ ) __/ ) __/\ /\ / ) / )( )( ) _) _ )(( O )
\_/\_/(__) (__) (_/\_)(__\_)(__) (__) (____)(_)(__)\__/
👩⚕️ Running Appwrite Doctor for version 1.3.6 ...
Checking for production best practices...
🟢 Hostname has a public suffix (aw.mydomain.tld)
🟢 CNAME target has a public suffix (aw.mydomain.tld)
🟢 Using a unique secret key for encryption
🟢 App environment is set for production
🟢 Abuse protection is enabled
🟢 Console access limits are enabled
🔴 HTTPS force option is disabled
🔴 Logging adapter is disabled
Checking connectivity...
Database............connected 👍
Queue...............connected 👍
Cache...............connected 👍
SMTP.............disconnected 👎
StatsD..............connected 👍
InfluxDB............connected 👍
Checking volumes...
🟢 Uploads Volume is readable
🟢 Uploads Volume is writeable
🟢 Cache Volume is readable
🟢 Cache Volume is writeable
🟢 Config Volume is readable
🟢 Config Volume is writeable
🟢 Certs Volume is readable
🟢 Certs Volume is writeable
Checking disk space usage...
🟢 Uploads Volume has 34.44GB free space (31.67% used)
🟢 Cache Volume has 34.44GB free space (31.67% used)
🟢 Config Volume has 34.44GB free space (31.67% used)
🟢 Certs Volume has 34.44GB free space (31.67% used)
Failed to check for a newer version
Current SMTP config (returned through docker compose exec appwrite-worker-mails vars
):
- _APP_SMTP_HOST=smtp.sendgrid.net
- _APP_SMTP_PORT=465
- _APP_SMTP_SECURE=tls
- _APP_SMTP_USERNAME=apikey
- _APP_SMTP_PASSWORD=mypassword
So you telnet to that host and port and it works?
Yes
you telnet from your appwrite server?
from the ssh where the docker compose is running, not from any of the actual containers
and what was the telnet command you ran?
telnet smtp.sendgrid.net 465
Response is
Trying 18.197.194.208...
Connected to smtp.sendgrid.net.
Escape character is '^]'.
interesting...can you try downloading this script into your appwrite folder and try to run it? https://gist.github.com/stnguyen90/869ca2addbc2f61e17490fc468932e6a
and who's your vps provider?
Contabo
Script returns
sendmail: send:'NOOP'
write:errno=0
sendmail: NOOP failed
can you try changing port 465 to 587?
now the script returns
sendmail: send:'NOOP'
140130297396040:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:331:
sendmail: helper exited (1)
Oh but it works
The e-mail has come through
nice how about the doctor script now?
shows SMTP................connected
👍
Thanks a lot!
[SOLVED] Can't get SMTP to send e-mails
Recommended threads
- I recently applied for the free plan und...
I recently applied for the free plan under the GitHub Student Developer Pack. However, my billing status still shows $15, and it mentions that this amount will ...
- Bug Report: Appwrite Console UI Issue on...
Steps to Reproduce: - Navigate to any collection page in the Appwrite console UI. - Open the menu and click on "Create Collection." - Observe that the dialog to...
- Send Email Verification With REST
I am using REST to create a user on the server side after receiving form data from the client. After the account is successfully created i wanted to send the v...