LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-28-2009, 08:07 AM   #1
imkornhulio
Member
 
Registered: Aug 2008
Posts: 58

Rep: Reputation: 15
Email Shell Script


I need to create a Shell Script which would attach a file from a particular location and email it to multiple recipient. I would also like to change the from address while sending out the email

i tried to use mutt

#!bin/bash
echo | mutt -a /home/file.csv -s "This is a Test" test@yourdomain.com

Please Help!!!

Last edited by imkornhulio; 05-28-2009 at 08:52 AM.
 
Old 05-28-2009, 09:10 AM   #2
imkornhulio
Member
 
Registered: Aug 2008
Posts: 58

Original Poster
Rep: Reputation: 15
The above code works but it doesn't allow me to us multiple address and change the from email address. Please help

Last edited by imkornhulio; 05-28-2009 at 09:18 AM.
 
Old 05-28-2009, 09:24 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

echo "Text goes here" | mailx -r "new.from@email.address" -s "subject line goes here" -a "path/name attachment" user1 user2 userN

See man mailx for details.

Hope this helps
 
Old 05-29-2009, 08:37 AM   #4
imkornhulio
Member
 
Registered: Aug 2008
Posts: 58

Original Poster
Rep: Reputation: 15
Thanks a lot for the code.
 
  


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
Having a problem getting my shell script to send an email after each row. mgsmith7475 Linux - Newbie 3 04-27-2009 08:28 PM
Grep Syslog - email shell script voodoofxz Linux - Newbie 1 09-06-2005 04:27 PM
write a shell script to send email yenonn Programming 4 02-11-2005 10:06 PM
Shell script, validating email and website Joey^s Programming 5 12-04-2004 05:31 PM
Email headers in shell script anjaan Programming 3 07-07-2004 01:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:10 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