Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Actually, I had prepared the answer and when I saw the second one was failing, I though it was more important... When I'm back on the right computer, I'll post it
and the command update-alternatives --display mailx returns
Code:
mailx - auto mode
link best version is /usr/bin/mail.mailutils
link currently points to /usr/bin/mail.mailutils
link mailx is /usr/bin/mailx
slave mail is /usr/bin/mail
slave mail.1.gz is /usr/share/man/man1/mail.1.gz
slave mailx.1.gz is /usr/share/man/man1/mailx.1.gz
/usr/bin/mail.mailutils - priority 30
slave mail: /usr/bin/mail.mailutils
slave mail.1.gz: /usr/share/man/man1/mail.mailutils.1.gz
slave mailx.1.gz: /usr/share/man/man1/mail.mailutils.1.gz
The script is from a magazine from 2006, maybe some parts are outdated. Since the article is for neebies, I would expect that default configurations at that time aren't valid nowadays because there is no particular warning about the command mail usage
Last edited by thomasbb; 02-23-2021 at 01:28 AM.
Reason: correction
ssmtp logs errors to /var/log/mail.log and /var/log/mail.err under the handle sSMTP. Check those files, especially the latter.
Check the ssmtp configuration. The things you have to set in /etc/ssmtp/ssmtp.conf are at least mailhub, and probably also root, UseSTARTTLS or UseTLS, and TLS_CA_File or TLS_CA_Dir.
Start with
Code:
sudo dpkg-reconfigure ssmtp
This can set root, mailhub, rewriteDomain, hostname, and FromLineOverride. For other settings, you'll have to edit /etc/ssmtp/ssmtp.conf in a text editor.
Obviously, the author expected the reader to do some extra homework... It's moving forward, now the file /var/log/mail.log has
Code:
date hostname sSMTP[number]: Creating SSL connection to host
date hostname sSMTP[number]: Connection lost in middle of processing
and the file /var/log/mail.err has only
Code:
date hostname sSMTP[number]: Connection lost in middle of processing
The command sendmail has the same behavior and they don't prompt for a username or a password. Once ran, neither C-d or C-c stop the command. The shortcut C-z does, but then the process needs a kill -9 afterwards.
In my /etc/ssmtp/ssmtp.conf, I didn't set the AuthUser and AuthPass variables, but if I do the same happens so I removed the lines
The message Connection lost in middle of processing comes pretty early on, even before the SMTP connection is open. Are you sure the mailhost and the port specified in the mailhub line of ssmtp.conf are correct?
If you don't know the exact name of your SMTP server, try something like
Code:
nslookup -type=mx gmail.com
Replace gmail.com with the domain name of your mail provider. Even better, contact them and ask what server name, port and authentication protocol you should use.
The configuration I set for mailhub in ssmtp.conf is the setting I use in Thunderbird, that is an smtp name and a port: smtp.uni.org:487 (but I have no idea if this is what I'm supposed to use for the ssmtp command)
The command smtpping -c1 e@ mail.com returns:
Code:
$ smtpping -c1 e@mail.com
PING e@ mail.com ([my.ip]:25): 10316 bytes (SMTP DATA)
seq=1, connect=0.95 ms, helo=156.74 ms, mailfrom=158.15 ms, rcptto=159.61 ms, datasent=341.27 ms, quit=342.65 ms
--- my.ip SMTP ping statistics ---
1 e-mail messages transmitted
connect min/avg/max = 0.95/0.95/0.95 ms
banner min/avg/max = 154.01/154.01/154.01 ms
helo min/avg/max = 156.74/156.74/156.74 ms
mailfrom min/avg/max = 158.15/158.15/158.15 ms
rcptto min/avg/max = 159.61/159.61/159.61 ms
data min/avg/max = 160.41/160.41/160.41 ms
datasent min/avg/max = 341.27/341.27/341.27 ms
quit min/avg/max = 342.65/342.65/342.65 ms
and the command nslookup -type=mx my.uni.maildomain returns
Code:
$ nslookup -type=mx my.uni.maildomain
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
univ-cotedazur.fr mail exchanger = 20 namedomain2.
univ-cotedazur.fr mail exchanger = 10 namedomain1.
Authoritative answers can be found from:
Just in case, I asked the admins if the configuration in /etc/ssmtp/ssmtp.conf and /etc/ssmtp/revaliases is fine. As soon as they answer, I'll let you know
Even better, contact them and ask what server name, port and authentication protocol you should use.
The configuration I was using yesterday goes just perfect today. Knowing myself, I must have made a typo somewhere...
Now script #2 in my magazine: backup of a mySql data base. If I had read it first, I would have known that mail was left to me to configure.
Thank you very much for your help
---
EDIT: in case someone falls on the same magazine...
File /etc/ssmtp/ssmtp.conf takes
Code:
root=your.email@your.uni.org # the email address that sends the message
mailhub=smtp.your.uni.org:your_port_number # port 25, 487, ...
hostname=the_hostname_of_your_PC # the name of the workstation
FromLineOverride=YES
AuthUser=your_login # the login you use to access your mailbox
AuthPass=your_password # the password you use to access your mailbox
UseSTARTTLS=YES # no idea what it is
UseTLS=Yes # no idea neither
and file /etc/ssmtp/revaliases takes
Code:
your_login:your.email@your.uni.org:smtp.your.uni.org:your_port_number # otherwise it tries to send the mail from your_login@the_hostname_of_your_PC
Last edited by thomasbb; 02-24-2021 at 07:50 AM.
Reason: add info
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.