You want your webhost to be able to send emails through an external SMTP server. The first thing to do is to check whether your webhost provider allows this to happen. Some concerned providers block outgoing SMTP ports to prevent you from doing email spamming. Let's try to connect with the SMTP server via Telnet from within your webhost. You may need to SSH into your webhost first. And then issue the following command:
$ telnet -4 mail.example.com 587
The above command will connect to the mail.example.com SMTP server via port 587 and force Telnet to use IPv4. If the connection fails then your webhost provider may have blocked the outgoing SMTP port 587. You may need to politely ask your webhost provider to open the port for you. You can't do it yourself.
Note: Telnet will resolve to IPv6 by default. If the SMTP port is not open on IPv6 then Telnet will appear hung until all trials via IPv6 connections are timed out. If IPv6 failed then it will resolve to IPv4.
Telnet should have received a response like the following:
Trying xxx.xxx.xxx.xxx...
Connected to smtp.server.com.
Escape character is '^]'.
220 smtp.server.com ESMTP Exim 4.95 Thu, 30 Jun 2022 20:33:24 +0000
ehlo mail.example.com
250-smtp.server.com Hello mail.example.com [xxx.xxx.xxx.xxx]
250-SIZE 52428800
250-8BITMIME
250-PIPELINING
250-PIPE_CONNECT
250-AUTH PLAIN LOGIN
250-STARTTLS
250 HELP
auth login
334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6
235 Authentication succeeded
data
354 Enter message, ending with "." on a line by itself
from: Admin <admin@example.com>
to: someone@gmail.com
Subject: Greetings from Webhost via Telnet
Hi!
This is a RFC 5322 compliant email sent using telnet from a webhost.
.
250 OK id=1o71wm-0006hR-UR
quit
Comments
Post a Comment