0
Basically the same question as Sendmail Configuration SMTP Relay Port 465, however, the answer there is "I have abandoned the idea of using my host as a sendmail relay and moved over to using Gmail".
However, I'm going to give it another try, so here is the situation.
- My mail server accepts SMTPS, (SMTP over SSL to port 465). So SMTPS configuration is the way I need, not STARTTLS, as
- STARTTLS starts the connection on port 25, then turns unencrypted connection into encrypted one.
- However, accessing port 25 to my mail server is blocked, to the reason you know, hence SMTPS only
Options
Here are different ways to do it, according to what I find from the Internet. However, I don't know which one to believe.
https://fedoraproject.org/wiki/Configure_sendmail_as_a_client_for_SMTPs says (on Aug 3, 2016),
Setting up SMTPS is fairly easy to do using a client like Evolution, however, it is not quite as straightforward to configure sendmail to do the job... When researching this topic I found a number of helpful sources on the internet. One of the problems though is that they didn't have all the pieces or something was a little off...
The initial step to setting up the SSL connection on port 465 is to configure and run stunnel. Stunnel provides a socket wrapper for ordinary programs to use SSL.
I.e., it says to use stunnel
. However,
https://www.cyberciti.biz/faq/howto-configure-sendmail-ssl-certificate-email/ says (on Dec 4, 2006),
Sendmail can be configured to encrypt email via the secure socket layer (SSL) when you want to send and receives emails.
Open sendmail configuration file/etc/mail/sendmail.mc
...append/modify following directives:
define(`confCACERT_PATH',`/etc/mail/ssl/certs')
define(`confCACERT',`/etc/mail/ssl/ca-bundle.crt')
define(`confSERVER_CERT',`/etc/mail/ssl/sendmail.pem')
define(`confSERVER_KEY',`/etc/mail/ssl/sendmail.pem')
and in https://groups.google.com/forum/#!topic/comp.mail.sendmail/Gy6QBfMd3l4 it says (on Oct 31, 2006)
Sendmail doesn't do client-side SMTPS...
You don't really need any certs for client-side setup - i.e. there is no config that needs to be done for client-side STARTTLS.
Question
So you can see that, there is quite some controversies over how to do it, according to what I find from the Internet.
Maybe because by the time when it is said, the option is not available, or maybe by the time when it is said, the author didn't know other options, etc, etc. Thus,
All in all, how to do client-side SMTPS with sendmail
as of year 2018? I.e.,
- SMTPS only, no STARTTLS.
- smtp.PlainAuth is good enough --
this Go code works 100%: https://gist.github.com/chrisgillis/10888032, but I want
sendmail
to do it, instead of writing Go/Nodejs/Python/Php/etc,etc codes
Thx.
1
Thank you for the msmtp information, although the guide you posted, it didn't help me, I used this one instead: https://hostpresto.com/community/tutorials/how-to-send-email-from-the-command-line-with-msmtp-and-mutt/
– Edenshaw – 2018-04-20T21:33:20.147