A simple mail command line utility?

Ace69

Senior member
Nov 26, 1999
877
0
0
I want to be able to send a text file on the command line. I want to be able to do this in one line. I DON'T want to install sendmail, so mail -s "subject" email@domain.com < textfile will not work. Does anyone have any suggestions for a simply SMTP program that will do this for me?

btw, I am running Red Hat 7.1
 

thornc

Golden Member
Nov 29, 2000
1,011
0
0
Have you tried mailx you should find an rpm in the RH cds

From rpm -qi mailx


<<
Name : mailx Relocations: (not relocateable)
Version : 8.1.1 Vendor: Red Hat, Inc.
Release : 10 Build Date: Fri Feb 4 00:46:20 2000
Install date: Wed Jul 19 22:35:47 2000 Build Host: porky.devel.redhat.com
Group : Applications/Internet Source RPM: mailx-8.1.1-10.src.rpm
Size : 73465 License: BSD
Packager : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Summary : The /bin/mail program, which is used to send mail via shell scripts.
Description :
The mailx package installs the /bin/mail program, which is used to
send quick email messages (i.e., without opening up a full-featured
mail user agent). Mail is often used in shell scripts.

You should install mailx because of its quick email sending ability,
which is especially useful if you're planning on writing any shell
scripts.
>>



Good Luck!
 

Koeppster

Senior member
Jul 6, 2001
331
0
0
/bin/mail is not part of sendmail. It is part of the mailx package, which you may already have installed, perhaps not.
 

thornc

Golden Member
Nov 29, 2000
1,011
0
0
but mailx uses sendmail, just found that out...... I tried it on my lappy and no go, it won't send the mail because
I don't have sendmail.....

Sorry ace :(
 

krogoth

Member
Apr 26, 2000
192
0
0
It should be easy to install Postfix and configure it with yours source domain, and it is compatible with sendmail.
 

Ace69

Senior member
Nov 26, 1999
877
0
0
I tried the mail command and this is what I got:

mail -s "test" abertram@risc.usi.edu < test
/usr/sbin/sendmail: No such file or directory

so....it looks like it has to have sendmail to work.
 

Ace69

Senior member
Nov 26, 1999
877
0
0
There has to be some simple little shell script that I can use.

All I would have to do is have it let me specify the SMTP server, subject and give me the ability to attach a text file.
 

Koeppster

Senior member
Jul 6, 2001
331
0
0
Well, I think you're just going to have to live with installing an MTA. sendmail, qmail, postfix, and exim are options.

Since you need access to port 25 (a privileged port), any script that might conceivably do what you want would probably have to have elevated privileges.

I searched Freshmeat to no avail.

Good luck.

(btw, is the objection to sendmail the space it takes up? security concerns? you just don't like sendmail? cpu/memory limitations?)
 

Ace69

Senior member
Nov 26, 1999
877
0
0
This is one that looked very good for my purposes. ---> smtpclient. It works great, but I can't attach the file, it looks like.

I don't want to mess with Sendmail because I believe that it is just overkill for what I am trying to do and it would be one less thing to load on bootup. I am going to install Sendmail eventually, but I just don't want to right now.
 

Koeppster

Senior member
Jul 6, 2001
331
0
0
Here's a Perl module, I can't say how useful it would be to you.

Installing sendmail wouldn't be overkill. It takes up very minimal resources (at least on my box), and it's a snap to configure if you're used to it. It's much more of a help than a hassle.