LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-22-2011, 04:02 AM   #1
ekcr
LQ Newbie
 
Registered: Nov 2011
Posts: 9

Rep: Reputation: Disabled
Sendmail a file on linux (in a script)


Helo linuc gurus out there! I am a linux novice. how is the syntax supposed to look like in a shell script if i need to send a file to a certain email address??

Like i need a script that will do the following:

send the file: /home/report.txt to admin@xxxxxx.com

your help will be greatly appreciated. thank you in advance.
 
Old 11-22-2011, 04:11 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Jessie (Fluxbox WM)
Posts: 1,388
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
Assuming your mail transfer agent has been configured with the appropriate SMTP, something like:
Code:
mail admin@xxxxxxx.com -s 'subject' </home/report.txt
See the manpage for more details.

Last edited by neonsignal; 11-22-2011 at 04:14 AM.
 
Old 11-22-2011, 04:14 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,335
Blog Entries: 55

Rep: Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535Reputation: 3535
Personally I prefer 'mpack -s subject /path/to/file recipient@addr.ess' as it creates a proper MIME type message with the file as attachment regardless of its contents.
 
1 members found this post helpful.
Old 11-22-2011, 04:26 AM   #4
ekcr
LQ Newbie
 
Registered: Nov 2011
Posts: 9

Original Poster
Rep: Reputation: Disabled
Your suggestion works like a charm!! Thank you very much you have saved my day at work!!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Cannot build sendmail.cf from sendmail.mc file simplified Linux - Server 5 11-01-2008 04:10 AM
Create a script to display file name, Inode, and size of any file. Has to be a script JaxsunApex Linux - Newbie 7 01-29-2007 08:15 PM
How to write script file in Linux? rust8y Linux - General 3 05-20-2006 05:49 AM
sendmail: I can't find the file sendmail.mc Ali79 Linux - Software 1 02-17-2005 12:25 PM


All times are GMT -5. The time now is 09:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration