Sunday, September 23, 2018

smtp - send email through stdin on Debian: "Mailing to remote domains not supported"



As per another answer, if you want to send mail directly from stdin, you can pipe it to sendmail -t, as in, printf "Subject: test\nTo: test@example.org\nFrom: test@example.com\n\ntesting" | sendmail -t.



However, when I've tried doing this on my Debian 7 (wheezy), I got nothing outside the box, and, from within, Mailing to remote domains not supported, from Exim4. Suggested approach includes running dpkg-reconfigure exim4-config, however, there is not a single option to enable sending mail directly through SMTP, without also receiving it.




What's the easiest way to fix Exim4, or quickly replace it with something that's not nearly as complicated?! I don't even need pool support, just a single attempt to send over SMTP.


Answer




# 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 R=nonlocal: Mailing to remote domains not supported
#



Apart from installing dma as per https://packages.debian.org/jessie/dma, which is unavailable in wheezy, the solution for wheezy appears to be selecting the internet option within dpkg-reconfigure exim4-config, which, provided the other defaults are kept, doesn't actually open the SMTP port to the internet, because by default it'll only listen on the localhost IPv4/IPv6 addresses.







It appears that there's a Debian-specific /etc/exim4/update-exim4.conf.conf (yes, it's a double .conf.conf, that's not a typo), which plays a part in this fiasco. Here's the relevant parts after running dpkg-reconfigure exim4-config and only changing the first option within the wizard, which enables sending mail, but appears to still keep the SMTP port open only to the machine itself (a default option if you just click-through in the reconfig):



dc_eximconfig_configtype='internet'

dc_local_interfaces='127.0.0.1 ; ::1'

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...