Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending mail without having to use sendmail

12 views
Skip to first unread message

Harold Johanssen

unread,
Nov 17, 2022, 10:54:03 AM11/17/22
to
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

unread,
Nov 17, 2022, 11:14:20 AM11/17/22
to
Am 17.11.2022 um 15:53:57 Uhr schrieb 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

unread,
Nov 17, 2022, 11:22:46 AM11/17/22
to
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..."
# add...@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="myn...@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:PASS...@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

unread,
Nov 17, 2022, 11:28:46 AM11/17/22
to
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"

Lew Pitcher

unread,
Nov 17, 2022, 11:30:42 AM11/17/22
to
On Thu, 17 Nov 2022 16:22:43 +0000, Harold Johanssen wrote:

> On Thu, 17 Nov 2022 15:53:57 -0000 (UTC), Harold Johanssen wrote:
>
>> 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:

Well, spank my asterisk and call me Judy.

Thanks for that, I've learned something new today :-)

Bit Twister

unread,
Nov 17, 2022, 11:41:35 AM11/17/22
to
On Thu, 17 Nov 2022 16:28:43 -0000 (UTC), Lew Pitcher wrote:

> 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

unread,
Nov 17, 2022, 1:08:28 PM11/17/22
to
On Thu, 17 Nov 2022 10:41:33 -0600, Bit Twister wrote:
> 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

Rich

unread,
Nov 17, 2022, 1:40:31 PM11/17/22
to
Harold Johanssen <noe...@please.net> wrote:
> On Thu, 17 Nov 2022 15:53:57 -0000 (UTC), Harold Johanssen wrote:
>
>> 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:

In case you still want a reference to a "simpler way" there is also
msmtp: http://slackbuilds.org/repository/15.0/network/msmtp/

Chris Elvidge

unread,
Nov 18, 2022, 6:21:51 AM11/18/22
to
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

unread,
Nov 20, 2022, 7:01:59 AM11/20/22
to
On Thu, 17 Nov 2022 15:53:57 -0000 (UTC), Harold Johanssen wrote:

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
0 new messages