Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Ê×Ò³>>Unix&Linux>>Send mail from script

Send mail from script

giskard22
12-22-2005, 12:12 PM
How do you send email messages from a shell script? I thought it was something like:

echo "text" | mail -s subject my@email.address

When I do that, no messages show up (and I get no feedback).

I found this old page (http://www.matisse.net/OSX/intro_unix/05g_Sending_Email.html) which claims you have to change the default sendmail configuration before this works. Do you still have to do this? Are there newer instructions for 10.4?

jbc
12-22-2005, 12:47 PM
Afaik, yes, you need Mail Transfer Agent running on your machine in order to send mail from the command line. This could be the default Postfix installation, or it could be any MTA you care to install (fink or darwinports are handy for this).

If you need more options than the mail command provides, you can install an alternate command-line mailer or a command-line mail client. I have exim + mutt set up on my system, and they allow me to automate creating and sending fairly complex emails (with attachments) via shell scripts quite nicely.

It may be possible to set up an email client like mutt to send mail without an MTA installed; I'm not sure, I've never tried it!

giskard22
12-22-2005, 02:57 PM
Thanks. I'm doing this on 10.4 Server, so I just enabled SMTP and started Mail service. That seemed to make everything work.


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
ssh setup for password
Bash script does not w
esc code 
ARD send unix command 
question about binarie
Scanning mail 
Issuing multiple comma
How do I install Linux

News Archive

/etc/hosts? 
Manually Start a Start
mounting missed hard d
Using Netinfo in Singl
darwin/bsd login probl
system_profiler and fi
Send mail from script 
mounting a drive 
OS X disk first aid ha
system.log shows steal

Related stories:

Using Netinfo in Single User Mode
darwin/bsd login problem
system_profiler and find Harddrive
mounting a drive
OS X disk first aid hangs
system.log shows stealth mode connection attempts
good book for newbies to OSX command line

Copyright@2004-2005 www.zzcoke.com All Right Reserved

link:Citenna