The UHF of the film world.
Latest news

quietearth [General News 09.25.06]



I needed to send email from the command line, specifically for cron jobs, and there are many programs which can do this. I'm going to use the gnu mailutils package so first off let's install the mailutils package:
# apt-get install mailutils

This will add a few extra packages, then bring us up into an exim4 configuration screen. My systems are behind a dsl router, and I'm not going to route the mail through any relay host, I just want everything sent direct (for some sendmail agents this might cause problems, but you'll have to look at your logfiles). In the exim4 config screen I pick "internet site... mail is sent and receieved directly using SMTP". On edgy you might have to answer a few more questions, but I had to run a dpkg-reconfigure.


At this point we have exim4 listening on port 25 and I don't need that, so I need to stop the daemon and remove the startup links:
# /etc/init.d/exim4 stop
# update-rc.d -f exim4 remove


The update-rc.d command removes inits startup/shutdown links, but unfortunately if the exim4 packages get updated the links will be back so we need to run that command again.

Now lets try sending a test mail:
# echo testing | mail -s Bla myemail@somewhere.com

and take a look at /var/log/exim4/mainlog. You should be good to go!

Tested under dapper and edgy.

You might also like

avatar

Anonymous (12 years ago) Reply

An easiest way would have been to install the ssmtp package before mailutils. No big exim package would have been installed then.

avatar

shabbir (7 years ago) Reply

apna resture
nt G.T.Road karyala sarai alamgir 4 vds

avatar

Anonymous (11 years ago) Reply

Under Feisty, just run 'aptitude install mailutils'

avatar

Posicionamiento (10 years ago) Reply

Nice tip. But mail does not exit. In log says:
'Mailing to remote domains not supported'

avatar

Posicionamiento (10 years ago) Reply

Ok i have to config exim4 with this:
'dpkg-reconfigure exim4-config'

avatar

Joe (10 years ago) Reply

Another one:

apt-get install sendemail

sendemail is very lightweight

avatar

vikaskumarroy (10 years ago) Reply

Nice One

avatar

Anonymous (10 years ago) Reply

If you have access to an open relay (usually on your local network) I recommend using the package "sendEmail" (note the capital E). It has no dependencies except perl so it's alot handier than setting up exim etc!

avatar

Anonymous (8 years ago) Reply

quoting sendEmail as a no nonsense commandline email utility is a very good tip.
Thanks
Piet Knoester

avatar

Dacicus (8 years ago) Reply

how to configure sendemail ?i get the following messege:
Feb 03 15:13:25 XXXXX sendemail[7815]: ERROR => Connection attempt to localhost:25 failed: IO::Socket::INET: connect: Connection refused

avatar

sagar thorat (8 years ago) Reply

pliz send udaunto cammand for webmail server installation

avatar

yc (8 years ago) Reply

mailutils package works great on ubuntu 10!

avatar

Mark (8 years ago) Reply

Thank you. It worked.

avatar

g (8 years ago) Reply

how to configure the 'dpkg-reconfigure exim4-config' anyway?

huh.....

avatar

Christian Louboutin 2010 (8 years ago) Reply

Thank you. It worked.

avatar

Brian (7 years ago) Reply

When I try sending email to my address, no errors, but the mail doesn't come to my yahoo inbox. Can you explain more?

Ty
B

avatar

ali (8 years ago) Reply

Great Post, Thank you.

avatar

sandhya (8 years ago) Reply

but I got an error like permission denied

avatar

shankar (7 years ago) Reply

Thank you..

avatar

gavin (7 years ago) Reply

The previous comment about case-sensitive package name "sendEmail" made me a bit paranoid. I had to test it to be sure, but "apt-get install sendemail" is the same as "apt-get install sendEmail". Obviously, I'm a bit of a noobie... and this message is aimed at other noobies.

avatar

gavin (7 years ago) Reply

... addendum, those looking for the smallest mail package should also look at: bsd-mailx

avatar

Pachs (7 years ago) Reply

Thanks a lot solved my problem instantly.


Leave a comment