Discussion:
Sending mail without having to use sendmail
(too old to reply)
Harold Johanssen
2022-11-17 15:53:57 UTC
Permalink
I have a system running 15.0 with Internet access. Every so often
this system must send terse email notifications, as invoked from a cron
job. It is not going to receive any emails.

Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Marco Moock
2022-11-17 16:14:17 UTC
Permalink
Post by Harold Johanssen
Any suggestions on how to do this without having to get
sendmail configured and running? This would amount to using an email
client that does not require a local sendmail, like e.g. Thunderbird.
This is of course not a an option: I need something that is
command-line oriented and lightweight.
What is the problem in installing sendmail?
Configure it so it doesn't list on any port and, if needed, configure
SMART_HOST.
You can of couse use any other SMTP client if you want to send out via
SMTP (with sendmail you can also use other protocols).
Harold Johanssen
2022-11-17 16:22:43 UTC
Permalink
I have a system running 15.0 with Internet access. Every so often this
system must send terse email notifications, as invoked from a cron job.
It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Well, as it turns out to be the case spookily often, I figured it
out minutes after I posted this. In case anybody might be interested:

I created a file named .mailrc in the home directory for the user
who is going to be sending the emails, with the following contents in
this file:

# Testing syntax:
# echo "Testing, Testing, Testing" | mailx -s "My test..."
# ***@whatever.com

# Use v15.0 compatibility mode
set v15-compat

# See the whole process, especially for troubleshooting:
set verbose

# Essential setting: select allowed character sets
set sendcharsets=utf-8,iso-8859-1
# and reply in the same charset used by sender:
set reply-in-same-charset

# Default directory where we act in (relative to $HOME)
set folder=mail

# You actual address to reply to:
set from="***@myaddress.com"

# Request strict TLS transport layer security checks

# set tls-verify=strict
# set tls-ca-file=/etc/ssl/certs/ca-certificates.crt
# set tls-ca-no-defaults

# Alternative, don't do SMTP server certificate verification

set tls-verify=ignore
set smtp-use-starttls
set smtp-auth=login

# When sending messages, wait until the Mail-Transfer-Agent finishes.
# Only like this you will be able to see errors reported through the
# exit status of the MTA (including the built-in SMTP one)!
set sendwait

# And of course put your own username and password here in the obvious
# places:

set mta=smtps://USERNAME:***@SMTP.SERVER:465


With this, a simple invocation as mentioned at the top of the
file sends the email as expected. In my case, I disable TLS security
checks because I know what the SMTP server that will be connecting to is,
and that's the only server that I will be using here. All this suffices
to fulfill my needs.
Lew Pitcher
2022-11-17 16:30:39 UTC
Permalink
Post by Harold Johanssen
I have a system running 15.0 with Internet access. Every so often this
system must send terse email notifications, as invoked from a cron job.
It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Well, as it turns out to be the case spookily often, I figured it
I created a file named .mailrc in the home directory for the user
who is going to be sending the emails, with the following contents in
Well, spank my asterisk and call me Judy.

Thanks for that, I've learned something new today :-)
--
Lew Pitcher
"In Skills, We Trust"
Rich
2022-11-17 18:40:28 UTC
Permalink
Post by Harold Johanssen
I have a system running 15.0 with Internet access. Every so often this
system must send terse email notifications, as invoked from a cron job.
It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Well, as it turns out to be the case spookily often, I figured it
In case you still want a reference to a "simpler way" there is also
msmtp: http://slackbuilds.org/repository/15.0/network/msmtp/
Lew Pitcher
2022-11-17 16:28:43 UTC
Permalink
I have a system running 15.0 with Internet access. Every so often this
system must send terse email notifications, as invoked from a cron job.
It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Nope. You are probably going to need an SMTP server.
In Slackware 15.0, you have your choice of the "Postfix" SMTP server
or the Sendmail.org "Sendmail" SMTP server.

Note that, while "Sendmail" /was/ the standard mailserver for Slackware
releases, Pat V. moved it to the "extra" directory, and changed the
default to the "Postfix" server. "Postfix" seems to use an easier, less
arcane configuration system than "Sendmail" does.
--
Lew Pitcher
"In Skills, We Trust"
Bit Twister
2022-11-17 16:41:33 UTC
Permalink
Post by Lew Pitcher
Note that, while "Sendmail" /was/ the standard mailserver for Slackware
releases, Pat V. moved it to the "extra" directory, and changed the
default to the "Postfix" server. "Postfix" seems to use an easier, less
arcane configuration system than "Sendmail" does.
And comes with the feature of who to route all of root's eamil

# tail -9 /etc/postfix/aliases | head -3
# CHANGE THIS LINE to an account of a HUMAN
root: bittwister

set desired value and as root run
postalias aliases

then restart postfix, shoot root an email with
maix -s "testshot" root < /dev/null
and verify root's testshot mail message is in the users inbox.
Henrik Carlqvist
2022-11-17 18:08:25 UTC
Permalink
Post by Bit Twister
And comes with the feature of who to route all of root's eamil
That can be done also with sendmail:

tail -2 /etc/mail/aliases
# send all root mail to henca
root: henca

Whenever /etc/mail/alisases has been edited the program newaliases must
be run for sendmail to recognise the changes.

regards Henrik
Chris Elvidge
2022-11-18 11:21:46 UTC
Permalink
Post by Harold Johanssen
I have a system running 15.0 with Internet access. Every so often
this system must send terse email notifications, as invoked from a cron
job. It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
https://github.com/deanproxy/eMail
git clone --recursive https://github.com/deanproxy/eMail
Doesn't require a local server at all.
But see: https://github.com/deanproxy/eMail/issues/60
also.
--
Chris Elvidge
England
Joseph Rosevear
2022-11-20 12:01:55 UTC
Permalink
I have a system running 15.0 with Internet access. Every so often this
system must send terse email notifications, as invoked from a cron job.
It is not going to receive any emails.
Any suggestions on how to do this without having to get sendmail
configured and running? This would amount to using an email client that
does not require a local sendmail, like e.g. Thunderbird. This is of
course not a an option: I need something that is command-line oriented
and lightweight.
Well, you can use a Python script to send email using a commercial email
server. I had a need to do this, so I went looking. This is what I
found:

https://www.tutorialspoint.com/send-mail-with-attachment-from-your-
gmail-account-using-python

Note that the original had a bug. It had:

Content-Decomposition

instead of

Content-Disposition

I fixed the bug and rearranged the code a little, adding to its
usefulness and suitability for my needs along the way. You can get my
script from:

https://sourceforge.net/projects/dupe/files/

but it may be an older version. Let me know that you want it and I'll
provide the updated script.

There is more to this story--go to

https://JoesLife.org

Loading...