Testing Zoho Mail server from ssh - email

I want to ensure our server able to connect and send emails using Zoho's service. How do I test this purely via terminal connected to my server's ssh?
Server's setting is Linux Ubuntu but a platform agnostic answer would be most appreciated.
Following is Zoho's mail server details:
https://www.zoho.com/mail/help/zoho-smtp.html

Connect to smtp.zoho.com on the port 25 for establishing smtp connection and send mails. For SSL/TLS connections, openssl library should be used for establishing smtp connection
For simple smtp connection
telnet smtp.zoho.com 25
For SSL connection
openssl s_client -connect smtp.zoho.com:465
For TLS connection
openssl s_client -starttls smtp -connect smtp.zoho.com:587 -crlf -ign_eof
Hope this suffices

Related

Why does openssl s_client fail to get the server certificate of my AWS postgres endpoint?

I wanted to check the server certificate used by my AWS RDS postgres instance. I executed below command.
openssl s_client -connect <db_domain_name>:5432 -showcerts
It gave me the output below, which shows that the instance doesn't provide a certificate.
CONNECTED(00000003)
140121607600016:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 289 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
....
....
But if I try to connect to the database via psql, it shows me that it is using SSL.
psql (9.2.24, server 13.7)
WARNING: psql version 9.2, server version 13.0.
Some psql features might not work.
SSL connection (cipher: ECDHE-RSA-AES128-GCM-SHA256, bits: 128)
Type "help" for help.
postgres=>
How does psql establish the SSL connection without server providing a certificate? If the server actually provides a certificate, why does openssl s_client fail to retrieve it?

Trying to connect to Gmail's SMTP

I'm trying to connect to Gmail's SMTP.
First, I get its smtp server.
dig mx gmail.com
gmail-smtp-in.l.google.com is the one with the lowest priority.
I think I could try telnet'ing to that address at this point, however Gmail requires TLS, and telnet does not support it.
I try openssl then, for ports 25, 587 and 465:
openssl s_client -starttls smtp -connect gmail-smtp-in.l.google.com:587
The command above returns nothing... why?
However, this one does connect:
openssl s_client -starttls smtp -connect smtp.gmail.com:587
Why?
The server of gmail-smtp-in.l.google.com is not accessible on 587 port, but it is on 25.

Vanilla forum "SMTP Error: Could not connect to SMTP host."

Since I upgraded my production site (Linux, Apache) from Vanilla 2.2.1 on PHP 5.5 to Vanilla 2.3.1 on PHP 7.0, my site cannot send emails - failing with the message "SMTP Error: Could not connect to SMTP host."
My settings are:
SMTP Host: smtp.gmail.com
SMTP User: [my email]
SMTP Password: [my password]
SMTP Port: 465
SMTP Security: SSL
I read many similar questions on SO and tried the following:
Confirm OpenSSL is enabled
Confirm with the hosting provider that port 465 is not blocked on their firewall
Telnet test on the hosting server gives this:
$ telnet smtp.gmail.com 465
Trying 108.177.97.108...
Connected to smtp.gmail.com.
Escape character is '^]'.
Connection closed by foreign host.
Switching to a different hosting server (same provider) with PHP 7.0, but same error
Not sure if this will be useful information, but when I try TLS with port 587 it gives another error - "Language string failed to load: tls"
My local test site with Vanilla 2.3.1 on PHP 7.0 (Windows, IIS), an identical copy of the production, can send emails without problem with the above SSL settings.
Is there anything else I can try? Any help is appreciated!

mail is not working on my PC

Tried to send an email to myself in a bash script from Ubuntu (12.04) command line, it will not send. I even used wireshark to snoop traffic on port 25, don't even see tcp session got established.
mail -s "Subject" xxxxx#yahoo.com < msg.txt
It's supposed to be very simple: just find the server from the email address (xxxxx#yahoo.com), set up a TCP connection and follow the SMTP protocol. It doesn't even try to establish an TCP connection.
Any ideas? Thanks.
use the sendmail program. It's a lot simpler :)
sudo apt-get install sendmail
sudo sendmailconfig
echo testmail | sendmail address#gmail.com

How to specify port number when sending mail with postfix?

I've uncommented the 'submission' line in master.cf and I can 'telnet example.com 587' on my mail server with no problem but how do I send mail from the command line of the client to the postfix server over port 587?
My server is hosted as a digitalocean droplet (centos instance) on the internet and my client is my home laptop.
Each time I try to deliver a message with the 'mail user#example.com' command I instantly receive a rejection message because my isp blocks port 25.
Any help greatly appreciated :)
mail command will drop the mail to the SMTP server running on your home laptop and the SMTP server running on your home laptop is not configured i guess. So it is trying to deliver the mail by doing an MX lookup (i.e to port 25 of your MX server). If you want to do any smtp tests please try using swaks tool.
# For eg. to authenticate and send mail from your mail server, you will have to use
swaks -f you#example.com -t someone#yahoo.com -s example.com -p 587 --auth-user you#example.com --auth-pass somepass
# -f from
# -t to
# -s server
# -p port
# --auth-user username
# --auth-pass password
More info here Hope that helps.