This worked
From
https://moritzvd.com/email-with-smtp-debian-ubuntu/
In order to be able to use the mail command wee need to install mailx
sudo apt-get install bsd-mailx
Set mail transport agent to use msmtp
sudo nano /etc/mail.rc
append the following:
set mta=/usr/bin/msmtp
----- Mensagem de [email protected] ---------
Data: Sun, 04 Apr 2021 17:45:22 +0100
De: [email protected]
Assunto: Re: Help with msmtp-mta
Para: Fabrice Bauzac-Stehly <[email protected]>
Hi all!
Thanks Fabrice, for your thoughtful reply and for forwarding the
question here.
Replying below with more details about the issue:
I guess you're talking about this wiki page:
https://wiki.debian.org/msmtp[1]
Yes, and thank you for the improvements
These error messages are insufficient to understand what's wrong. Is it
all?
Yes. Anytime I try to use the "mail" command this is the message I get.
The first time after a reboot, I also get a keyring prompt. This
happens because of the configuration .msmtprc (auth login).
I suspect the process which "mail" talks about is in fact
/usr/bin/sendmail, which resolves as one of the msmtp programs; you can
check that by following the /usr/bin/sendmail symlink,
the /usr/bin/sendmail symlink points to "../bin/msmtp"
Also,
usr/bin/mail > /etc/alternatives/mail
usr/bin/mailx > /etc/alternatives/mailx
And these both point to /usr/bin/mail.mailutils
and by using
strace to see which child process of "mail" is the cause of this error
message:
strace -e trace=process -o /tmp/strace.log mail -s ...
Please see strace.log below
If I understood correctly, there is a msmtp daemon running somewhere.
> Have you looked at its logs?
No logs related to the daemon found in /var/log/ (tried mail, err
and logs, daemon logs, messages), what is the usual location? I
think it probably isn't related here.
---Strace Log---
execve("/usr/bin/mail", ["mail", "-s", "..."], 0xbfdd72e8 /* 41 vars */) = 0
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
--- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=7110, si_uid=1001} ---
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
--- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=7110, si_uid=1001} ---
--- SIGINT {si_signo=SIGINT, si_code=SI_KERNEL} ---
--- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=7110, si_uid=1001} ---
clone(child_stack=NULL,
flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0xb70fd9a8) = 7143
waitpid(7143, [{WIFEXITED(s) && WEXITSTATUS(s) == 65}], 0) = 7143
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=7143,
si_uid=1001, si_status=65, si_utime=17, si_stime=2} ---
exit_group(4132) = ?
+++ exited with 36 +++
--- ~/.msmtprc ---
# Set default values for all following accounts.
defaults
port 587
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
account geosapo
host smtp.sapo.pt
from [email protected]
auth login
user [email protected]
# Set a default account
account default : geosapo
----- Fim da mensagem de [email protected] -----
Ligações:
---------
[1] https://wiki.debian.org/msmtp