LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-06-2004, 06:34 PM   #1
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,513

Rep: Reputation: 46
How do I send mail from inside a script?


How do I send mail from inside a script?


Thanks!
 
Old 10-06-2004, 06:45 PM   #2
Samsara
Member
 
Registered: May 2003
Distribution: Ubuntu, Mac OS X Tiger
Posts: 481

Rep: Reputation: 32
You mean email? Use mailx.

HTH,

Samsara
 
Old 10-06-2004, 07:07 PM   #3
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,513

Original Poster
Rep: Reputation: 46
Does mailx use the local send mail agent? Can I point it to another?
 
Old 10-06-2004, 07:57 PM   #4
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 215

Rep: Reputation: 31
It could be something like this: (thanks to CAF Johnson for showing me this.

#!/bin/sh

messagefile=$1 ## contains the message to be sent
[ -f $1 ] || { echo "$messagefile does not exist"; exit 5; }

while read email
do
mail -s "Club newsletter" $email < $messagefile
done
## EOS ##

email contains the e-mail address.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shel script mail send ("/" in mail address) problem anaid Linux - Networking 3 08-23-2005 07:41 AM
CGI Script runs to send mail, but mail is never sent robertwo Linux - Newbie 2 06-10-2004 09:57 AM
bash script to send mail Cruger Programming 1 03-06-2004 08:25 AM
howto send a mail with attachment via perl script ? cccc Programming 24 03-05-2004 07:49 PM
I'm looking for a simply perl script to send mail, when ping down cccc Programming 2 01-12-2004 04:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration