Send mail without mailutils

Hi,

I have ~150 machines that send email from cron jobs. All the systems are identical and they use ssmtp to relay through one of our server configured with postfix .

postfix works fine because we receive all emails.
cron works fine on the machines.

What puzzles me is that mailutils is not installed on any machine. How is cron able to send emails?? What command can I use to send email from command line given /usr/bin/mail does NOT exist?

Thanks for you help.
Santiago

smtp over telnet does not use mailutils.

Here is a command line example session:

Telnet - SMTP Commands (sending mail using telnet)

I'm guessing that cron is calling /usr/lib/sendmail by default.

Andrew

And i think your guess is spot on.

@chebardudo: notice that "mail" (or rather, to be precise, SMTP) is a protocol first. It is a "language" systems are able to speak to send/receive mail messages. All the related programs ( mail , mailx , etc., but also the server programs like sendmail , postfix and whatnot) are just implementations of this protocol. Like it is possible to "speak" a certain language without using this translator but some other translator (or your own knowledge of the language) instead, it is possible to use a protocol without using a certain tool - just use either another tool or even implement the protocol as part of your own program.

I hope this helps.

bakuin

Amazing!
I ran the following script and it worked. Thank you jim mcnamara :

cat << EOF | telnet ndtv_server 25
HELO mydomain.com
MAIL FROM: terminal92@mydomain.com
RCPT TO: support@mydomain.com
DATA
Subject:Test ZY5EBU
Hello,
This is a message
Bye
.
EOF

Thanks apmcd47 and bakunin, Is there a way to call /usr/lib/sendmail from bash and have a simpler approach than telnet ?

$ cat >my_message <<EOT
From: Fred@flintsones.org
To: Barney@rubble.net
Subject: Pebbles loves BamBam!
Date: Tuesday 3rd May 1400BC

Hiya Barney!
Pebbles loves BamBam!

Cheers, Fred
EOT
$ /usr/lib/sendmail Barney@rubble.net < my_message

Untested, and from memory. You have to construct the headers yourself (not sure what happens if you miss out the date). You have to insert a blank line between the header and the body. You could pipe the message straight into the sendmail application.

I would suggest just trying sending messages to yourself and see what happens.

Andrew

Thanks Andrew,

I've noted a weird behavior. If I used this syntax:

cat << EOF | telnet ndtv_server 25
HELO mydomain.com
MAIL FROM: terminal92@mydomain.com
RCPT TO: support@mydomain.com
DATA
Subject:Test ZY5EBU
Hello,
Test
Bye
.
EOF

Then I receive a message:

And if I used this syntax:

cat << EOF | /usr/lib/sendmail support@mydomain.com
From: terminal92@mydomain.com
To: support@mydomain.com
Subject: Test AZ772Q
Date: $(date)

Hello,
Test
Bye
EOF

Then I receive a message:

Isn't that weird??
I'm interested in possible explanations.
Thanks again.
Santiago

That is odd. It may be worth checking the man page for sendmail and the binaries /usr/sbin/sendmail and /usr/sbin/ssmtp to see if they differ in behaviour. It worked as expected for me on a Sun, but that version of the binary is from the actual sendmail package, not ssmtp.

Andrew