home | list info | list archive | date index | thread index

Re: My ongoing email server adventure...


On 2/9/25 23:32, Dianne Skoll via linux wrote:
...
__sendEmail__
I installed sendEmail
(http://caspian.dotconf.net/menu/Software/SendEmail/), as I found
netcatting directly to port 25 from bash didn't work. SendEmail
works, and makes my bash script look more like a script. There seem
to be multiple tools like this. Preferences?
Why wouldn't you just use /sbin/sendmail (or perhaps
/usr/sbin/sendmail) which is Postfix's message submission agent?  That
way, if for some reason Postfix isn't listening on port 25, your email
gets queued anyway.

Why? Showing my working in the margin...

When I first searched how to send email from bash, the suggestion was to pipe stuff to netcat, using a similar approach to telnet localhost 25, and manually entering an email. I didn't like it, and my first attempt didn't work anyway.

sendmail -h or --help just reports "sendmail: fatal: usage: sendmail [options]"

sendmail with no parameters just waits for input (so I assumed it was similar to "telnet localhost 25")

man sendmail is big and complicated (16 pages), whereas "sendEmail --help" gives a nice 2 page explanation of an interface that does exactly what I wanted.

A nice readable bash script

sendEmail \
 -o fqdn=<mydomain> \
 -f postfix@<mydomain> \
 -t postmaster@<mydomain> \
 -u midnight report for $reportDate \
 -m "$(cat $targetFile)"

vs using sendmail

echo -e "Subject:midnight report for $reportDate\n$(cat $targetFile)" | sendmail -f "me [ at ] example [ dot ] com" -t "you [ at ] example [ dot ] com"

I get that | is very bashy, but really, I'm a verb first sort of guy.

Queuing the email if postfix is AWOL would be a benefit. Like when I got back to installing postfix a few weeks back, and found 80k emails from munin waiting for me... I know, I really should finish one project before starting another...

Tug


Regards,

Dianne.

To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org


To unsubscribe send a blank message to linux+unsubscribe [ at ] linux-ottawa [ dot ] org
To get help send a blank message to linux+help [ at ] linux-ottawa [ dot ] org
To visit the archives: https://lists.linux-ottawa.org