On Mon, May 09, 2022 at 11:01:20PM -0500, x...@trimaso.com.mx wrote:
> [...] In the end, I chose to begin with Msmtp instead of Postfix...
> Why? Because after just installation, I realized that Postfix is kind
> of "overkill" if just wanting to send: it's designed as a full-blown
> server for sending and receiving. Msmtp, on the other hand, is just a
> SMTP client; no need to setup a whole server. [...]


Good call :)

If you're using `msmtp`, you may already have read about `msmtpq`.

If not, have a quick look at this thread in case it is helpful to you :)

http://lists.mutt.org/pipermail/mutt-users/Week-of-Mon-20210208/002485.html



> So first read the Msmtp documentation, and then for sending I first
> tried:
> 
> printf "%b\n" "$msg" | mutt -s "Test message" -e 'set
> my_user="u...@domain.tld"; set my_url="smtp.domain.tld"; set
> record=""; set sendmail="/path/to/msmtp --port=587 --tls=on
> --host=$my_url --from="SendUser<$my_user>" --auth=on --user=$my_user"'
> recei...@domain.tld
> 
> Incientally "--password" is not a valid command line option; so I was
> expecting to be prompted for the password, but instead I got this:
> 
> msmtp: authentication method PLAIN needs a password
> msmtp: could not send mail
> Error sending message, child exited 69 (Service unavailable.).
> Could not send the message.

I'm not sure:

-    Why the command line you gave above did not prompt you for a
     password.  As the msmtp docs ( https://marlam.de/msmtp/msmtp.html )
     say, "Password method 5: Do not specify a password. Msmtp will then
     prompt you for it. This means you need to be able to type into a
     terminal when msmtp runs."

     Recent versions of Mutt automatically insert a `--` delimiter
     between the `sendmail` string and the recipient addresses before
     invoking the chosen MTA.

     Perhaps your version of Mutt does not, and perhaps this is somehow
     causing a problem?

     Consider adding ` --` (without backticks) to the end of the
     sendmail string in your example above.


-   Why you say '"--password" is not a valid command line option'.

    According to msmtp docs, "all settings can also be configured on
    the command line", and there is indeed a "--password" option:

        "‘password [secret]’

            Set the password for authentication. An empty argument
            unsets the password. Consider using the ‘passwordeval’
            command or a key ring instead of this command, to avoid
            storing cleartext passwords in the configuration file."



> Even after making a very minimalist .msmtprc with *only* the
> "password" line (trying plain password for now just for testing), I
> kept getting the above error. I did chmod .msmtprc to 600, BTW.
> 
> So had to make a full .msmtprc according to documentation, and tried
> this command:
> 
> printf "%b\n" "$msg" | mutt -s "Test message" -e 'set
> my_user="u...@domain.tld"; set my_url="smtp.domain.tld"; set
> record=""; set from="Send User<$my_user>"; set envelope_from=yes; set
> sendmail="/path/to/msmtp"' recei...@domain.tld
> 
> This time it succeeded.
> 
> 
> 
> ---So, do I really need to set password apart in some of Msmtp's other
> 4 ways in order to successfully use it?

In principle, no.  msmtp's method 5 (entering the password manually at
the terminal) should work.

If you cannot get it to work with your version of Mutt, then try it with
your version of heirloom mailx.  (Perhaps your version of Mutt, which is
very old, has a bug that is somehow causing a problem here?)

If for some reason it still doesn't work, then perhaps someone else here
will spot the reason why.

If not, then *maybe* msmtp has a bug.


That said, do you really want to manually enter the password each time
you send an email?  In the long run, you might be better off using
method 1 or 2 instead.


> ---To respond a received email in Mutt pager I hit 'r', and all the
> rest. I only change the destination email address, and eventually
> send. But even after successfully sent, the "responded" email in Mutt
> pager is not marked with 'r'. Why?

Maybe because in your examples above, you set the record variable to ""?

I may be wrong, but: I think that in order for Mutt to know whether a
message has been replied to, it checks the mailbox specified by the
record variable - so if that variable is empty, Mutt has no way of
checking.


Sam

-- 
A: When it messes up the order in which people normally read text.
Q: When is top-posting a bad thing?

()  ASCII ribbon campaign. Please avoid HTML emails & proprietary
/\  file formats. (Why? See e.g. https://v.gd/jrmGbS ). Thank you.

Reply via email to