On Thu, May 05, 2022 at 03:11:48PM -0500, x...@trimaso.com.mx wrote: > On Thu, May 05, 2022 at 12:07:44PM -0500, Kevin J. McCarthy wrote: >> 1) On the command line, the shell will expand shell variables inside >> double quoted strings, before Mutt even sees it. >> >> So in the part "set smtp_url=smtp://$my_user@$my_url" Mutt is >> probably only seeing "set smtp_url=smtp://@", because $my_user and >> $my_url are unset in your shell. You may want to use single-quotes >> around the whole "-e" expression, but then be careful with nested >> single quotes, e.g. the set from='User' part. > > First: had to delete/rename ~/.muttrc, because some previous settings > were perhaps conflicting...
Good call. > This seemed to *finally* work (had to play with both single and double > quotes...): > > printf "%b\n" "$msg" | mutt -s "Test message" -e 'set > my_user="u...@domain.tld"; set my_url="smtp.domain.tld"; set > from="Send User <u...@domain.tld>"; set > smtp_url="smtp://$my_user:my_p4ss@$my_url:587"; set > ssl_starttls="yes"; set ssl_force_tls="yes"' recei...@domain.tld > > Finally worked -seemingly- Great! > but popped just many doubts: > > ---There's a "sent email" log in local system, where sent emails are > logged. There's always this line: > Message-ID: < <alphanum_string.alphanum_string> @ > mylocalpcu...@localhost.myisp.com > > Is this correct? Almost certainly, yes. Understandably, you may prefer not to divulge that information to the recipients of your emails. I forget how to effect that for the username part, but for the hostname I think it's as simple as setting Mutt's `$hostname` variable. If you have multiple accounts, you may wish to do that via hooks, e.g.: send2-hook '~f @account1\.net$' 'set hostname = "account1.net"' send2-hook '~f @account2\.com$' 'set hostname = "account2.com"' send2-hook '~f @account3\.org$' 'set hostname = "account3.org"' etc. > ---Without "set from=" field, sender becomes > "mylocalpcu...@localhost.myisp.com"... What is this? That is a default value, derived from your system information. > Does the "from" field kind of guarantee that email is being *really* > sent from the u...@domain.tld address, and not from *local rig*? What do you mean? > ---In "set smtp_url" field, if using "$my_user:my_p4ss" notation, this > seems to override the "set smtp_pass" field completely? Mutt has to make one of those override the other. Otherwise, what would Mutt do if a user specified one password in $smtp_url and a different one in $smtp_pass? > ---Seemingly not needed smtp_authenticators... ?? What do you mean? > ---Without smtp_url and smtp_pass fields, where does email go? > recei...@domain.tld doesn't receive it... Depends on your system configuration. Have you looked in /var/mail/<username> ? > ---Is email really being sent with STARTTLS, as wanted? How can I > tell? Wireshark? :) Probably there are easier ways - someone else might have suggestions. Perhaps setting debug level to `-d 5` would give you the information you need? > ---In "set from=" field, spaces between "Send User" and actual email > address... don't seem to matter? > > > >> Are you able to send email via that account using other applications? > > Yes, I used to use Heirloom Mailx. Thanks for confirming. >> Yes. Whether or not you have to explicitly specify the port may >> depend on the mail server's configuration. This configuration can >> vary from ISP to ISP. > > I didn't mean email provider, but ISP internet service I'm connected > to. > > And did test again: I connected to an internet network, did not > specify port in smtp_url, tried send email, and got: Could not connect > to smtp.domain.tld (No route to host) Tried connecting to a different > internet network, tried to send email using *exact* command, without > port, and *it succceeded*. > > WTH? Does that behaviour happen consistently? I.e. with one ISP connection *never* succeeds without specifying the port, and with the other ISP it *always* succeeds without specifying the port? If so, then that is puzzling. Hopefully someone else on this list can offer a hypothesis. Anyway, congratulations on your progress! 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.