Re: Help with msmtp-mta

2021-04-05 Thread Fabrice Bauzac-Stehly
geoad...@sapo.pt writes:

> This worked: from https://moritzvd.com/email-with-smtp-debian-ubuntu/:
>
> In order to be able to use the mail command we 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

Good for you if it works!

I have the feeling that unfortunately the root cause of the initial
problem (it works with bsd-mailx but still fails with mailutils,
correct?) remains a mystery though.

  Maybe you would like to help investigating the issue, in which case we
  could discover and fix a bug, so that the issue doesn't hit anybody else
  in the future, which is good for the community.  If you would like to do
  that, there are things we can do to investigate, such as enabling msmtp
  logging with:

logfile -

  Which would allow to see the actual error message.  See
  https://marlam.de/msmtp/msmtp.html#Logging

But don't feel obliged to do that.  It's OK.  I have updated the wiki
page with your inputs anyway.

Thanks!

-- 
Fabrice Bauzac-Stehly
PGP 01EEACF8244E9C14B551C5256ADA5F189BD322B6
old PGP 015AE9B25DCB0511D200A75DE5674DEA514C891D



Re: Help with msmtp-mta

2021-04-04 Thread geoadmin

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 geoad...@sapo.pt -

 Data: Sun, 04 Apr 2021 17:45:22 +0100

 De: geoad...@sapo.pt

 Assunto: Re: Help with msmtp-mta

 Para: Fabrice Bauzac-Stehly 


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 geoad...@sapo.pt

auth login

user geoad...@sapo.pt

# Set a default account

account default : geosapo


- Fim da mensagem de geoad...@sapo.pt -





Ligações:
-
[1] https://wiki.debian.org/msmtp


Re: Help with msmtp-mta

2021-04-04 Thread geoadmin

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 geoad...@sapo.pt

auth login

user geoad...@sapo.pt

# Set a default account

account default : geosapo



Ligações:
-
[1] https://wiki.debian.org/msmtp


Re: Help with msmtp-mta

2021-04-03 Thread Fabrice Bauzac-Stehly
geoad...@sapo.pt writes:

> I was going throught msmtp docs at the debian wiki,but I'm still
> having trouble setting msmtp-mta.

I guess you're talking about this wiki page:
https://wiki.debian.org/msmtp

I've just reviewed it and updated it with a few improvements.

> [...] what would be the best channel to request support on this?

I don't know why you think I could particularly help you on msmtp, I
don't use it (I use mpop though).

I *think* you can discuss your issue on debian-user@lists.debian.org (I
have added it in Cc), to which I suggest you subscribe.  Another
possibility, if you are quite sure that there is an software issue
behind this, is to file a new bugreport (with e.g. the "reportbug" tool)
targetting the software you think is the culprit.

> The msmtp is working fine following the instruction on the wiki and
> elsewhere (this email is sent using msmtp), however web apps (in my
> case GNU Social), and anything else calling the mail command return
> errors:

> eg
>
> mail -s teste another@external.email < /dev/null
>
> returns:
>
> mail: Null message body; hope that's ok
> mail: cannot send message: Process exited with a non-zero status
>
> and:
> $ echo $?
> 36

These error messages are insufficient to understand what's wrong.  Is it
all?

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, 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 ...

If I understood correctly, there is a msmtp daemon running somewhere.
Have you looked at its logs?

> I tried uninstalling mailutils and msmtp-mta, then trying reinstalling
> the msmtp-mta only but then the mail command is not found.

I think uninstalling mailutils is a bad idea here.

> Also started msmtpd daemin manually, but doesn't seem to make a
> difference.
>
> I understood msmtp + msmtp-mta would suffice, but it appears not?
>
> I've tried several support channels, but few people seem to know
> enough to help.
>
> Could you help on this?
>
> Thanks!
>
> josely

-- 
Fabrice Bauzac-Stehly
PGP 01EEACF8244E9C14B551C5256ADA5F189BD322B6
old PGP 015AE9B25DCB0511D200A75DE5674DEA514C891D