LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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-23-2005, 02:59 PM   #1
dajomu
Member
 
Registered: Aug 2005
Posts: 31

Rep: Reputation: 15
command-line sendmail


How do I add subject to sendmail using the command line? This is what I want to do and then add the subject field.
Code:
sendmail user@domain.com < /path/to/the/file
 
Old 08-23-2005, 05:50 PM   #2
kencaz
Senior Member
 
Registered: Mar 2005
Location: Las Vegas, NV
Distribution: Mandriva Slackware FreeBSD
Posts: 1,468

Rep: Reputation: 48
Flying blind here... I use MailX but maybe this will work:

sendmail -s "Your_Subject" user@domain.com < /path/to/the/file

KC
 
Old 08-24-2005, 02:40 AM   #3
kees-jan
Member
 
Registered: Sep 2004
Distribution: Debian, Ubuntu, BeatrIX, OpenWRT
Posts: 273

Rep: Reputation: 30
That will most likely not work.

I concur, though, that sendmail is not the right tool for the job. mail or mutt will serve you better, as they both support the -s option.

If you insist on sticking to sendmail, I'd try something like

Code:
(echo Subject: Your subject ; echo "" ; cat thefile ) | sendmail address@somewhere
Basically, when using sendmail, all headers (including subject) should already be present in the file. So one could even improve this further to:

Code:
(echo To: address@somewhere ; echo Subject: Your subject ; echo "" ; cat thefile ) | sendmail -t
Groetjes,

Kees-Jan
 
Old 08-24-2005, 03:45 AM   #4
dajomu
Member
 
Registered: Aug 2005
Posts: 31

Original Poster
Rep: Reputation: 15
Ended up with this solution

Code:
cat /file/name | mail -s subject user@domain.com
Thanks anyway for helping out.
 
  


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
Sendmail from the command line Draithon Linux - Newbie 5 04-14-2011 03:57 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

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

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