LinuxQuestions.org
Register a domain and help support LQ
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 02-11-2005, 09:04 AM   #1
Draithon
LQ Newbie
 
Registered: Feb 2005
Location: USA
Posts: 16

Rep: Reputation: 0
Sendmail from the command line


I am trying to figure out how I can append a subject to sendmail from the command line. I am using RH Enterprise.

using bash shell

sendmail -f"from name" "recipient" <"file"

that sends the mail but no subject.

I have tried this as well

mail -s"Subject header" "recipient" <"file"

But that will not allow me to change the from address. It send it saying root, when I am trying to mask that.

any suggestions would be greatly appreciated.

thanks. back to
 
Old 02-11-2005, 01:24 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
You should be able to read in a file like the following into "sendmail -t"
Code:
to:recipient@somewhere.com
from:you@yourdomain.com
subject:Testing 123

This is my message.
 
Old 02-11-2005, 02:23 PM   #3
Draithon
LQ Newbie
 
Registered: Feb 2005
Location: USA
Posts: 16

Original Poster
Rep: Reputation: 0
I am sending a log file that I created, so I will have to try to format the log file in a manner that corresponds with your advice and see if that gives me what I am looking for.
 
Old 02-13-2005, 12:57 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
I haven't tried this but you should be able to do it with 2 files, one being the static header and the other being the log:
cat header.txt file.log | sendmail -t

Just remember to have the extra newline at the bottom of the header file.
 
Old 05-04-2009, 01:27 PM   #5
RichardBronosky
LQ Newbie
 
Registered: Feb 2007
Location: Atlanta, GA, USA
Distribution: KnoppMyth, Ubuntu
Posts: 18

Rep: Reputation: 1
Quote:
Originally Posted by david_ross View Post
I haven't tried this but you should be able to do it with 2 files
No need to create the 2nd file. That is what heredoc is for.

Code:
cat - file.log << EOF | sendmail -t
to:recipient@somewhere.com
from:you@yourdomain.com
subject:Testing 123

EOF
Lots of POSIX apps read stdin as the contents for argument/filename "-"

Ever done: grep Error | vim -
Same concept combined with a little extra bash-fu
 
Old 04-14-2011, 03:57 AM   #6
anandhavalli
LQ Newbie
 
Registered: Apr 2011
Posts: 2

Rep: Reputation: 0
sendmail configuration

I am in need of configuration settings and steps for sending mails from linux server to some other domain or network.
I need to send mail from linux system to my mail id.Please help me out in doing the same.
 
  


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
command-line sendmail dajomu Linux - Software 3 08-24-2005 03:45 AM
Using sendmail in command line Belghouth Mandriva 1 12-08-2004 10:55 AM
Sendmail command line usage Belghouth Debian 1 12-08-2004 10:54 AM
Sendmail command line examples please. leongoogs Linux - General 2 07-21-2004 08:23 AM
command line sendmail jchristman Linux - Software 4 03-13-2003 05:33 PM


All times are GMT -5. The time now is 07:26 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration