How can I set up any command line mail agent to deliver to gmail accounts?
2 Answers
It would seem that the text of this error might originate from exim4 in Debian:
# fgrep remote /var/log/exim4/mainlog.1 | sed -E 's#([ <])[^ <]+@[^ >]+([ >])#\1a@b\2#g' | head -1
2019-01-08 00:47:00 1ggebk-00055M-St ** a@b <a@b> R=nonlocal: Mailing to remote domains not supported
#It would appear that the solution would be to reconfigure exim4, and within the initial ncurses dialogue, make sure to select the internet site; mail is sent and received directly using SMTP option (in place of what is probably, the local delivery only; not on a network option):
dpkg-reconfigure exim4-configNote that although the top option implies that mail from the internet would now be accepted, it would appear that even if selected, by default it's still limited to the localhost IPv4/IPv6 addresses for accepting the mail (if you leave the defaults in subsequent prompts of the reconfig), so, it would seem that you don't really have to worry about having the smtp port open on the server to the outside world just by selecting the top-level option (TBH, it then makes little sense why it's not even the default, as sending mail to the outside world is a pretty common operation that generally works without any extra configuration on all BSD systems, for example, unless you're using something like Google Cloud, I guess, where the outgoing SMTP ports are blocked).
Here's a link there describe howto configure mutt for gmail.
2