LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 08-05-2004, 04:13 PM   #1
pwtct
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Rep: Reputation: 0
subject parameter for sendmail?


Can you specify a subject for an email when using sendmail at the command line to send an email?

My problem is a certain isp will not accept email with out a valid domain for the sender. Sendmail allows you to specify a sender with the -f switch. The 'mail' command allows a subject, but sendmail doesn't seem to have a switch for subject. Conversely, does 'mail' have a way to specify the sender, like sendmail does?

Thanks.
 
Old 08-05-2004, 06:07 PM   #2
born4linux
Senior Member
 
Registered: Sep 2002
Location: Philippines
Distribution: Slackware, RHEL&variants, AIX, SuSE
Posts: 1,127

Rep: Reputation: 49
mail -s "test email" -u sender receiver@domain.com << EOF
....
message goes here.
....

EOF
 
Old 08-06-2004, 07:46 AM   #3
pwtct
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
however, you can't specify the -u sender as "user@domain.com", only "user". The ISP wants "user@domain.com".
 
Old 08-06-2004, 10:39 AM   #4
pwtct
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
Say I have the following line in a shell script:

cat /var/log/messages | grep ${PID} | sendmail -froot@domain.com -t myself@domain.com

Ok. So sendmail can apparently parse out the headers of an email message, including 'Subject:', but the man page docs don't quite give me enough info, or I'm getting my piping wrong. I made the following attempt:

echo "Subject: Testing" `cat /var/log/messages | grep ${PID}` | sendmail -froot@domain.com -t myself@domain.com

I get an email with the entire echo'd string as the Subject. Also, the echo seems to do away with the crlf's at the end of each line of the cat|grep command. How does one tell sendmail where the header info ends, and the message begins? Can I structure this command so I don't have to echo the results of the cat so the crlf's are blown away?

I'm trying to grep the messages associated with a UPS daemon in the event of a power failure, and send off an email to the appropriate people.

Thanks.
 
Old 08-06-2004, 10:58 AM   #5
pwtct
LQ Newbie
 
Registered: Jul 2004
Posts: 6

Original Poster
Rep: Reputation: 0
d'oh, Found it:

http://www.linuxquestions.org/questions/history/206093
 
  


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
sendmail subject via script ryedunn Linux - Newbie 3 01-08-2005 12:11 PM
no subject Ammad Linux - Software 0 12-07-2004 01:48 AM
Sendmail Redirect by Message Subject? rld1025 Linux - Networking 1 10-26-2004 02:04 PM
sendmail.cf , filter by subject using regular expression? linuxlah Linux - Software 0 01-30-2004 11:01 PM
sendmail (dont just ignore it 'cause its got sendmail in the subject :P) GnomeKing Linux - Networking 1 11-12-2001 09:57 PM

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

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