- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Subject line with the sendmail command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2009 07:03 AM
тАО10-08-2009 07:03 AM
Subject line with the sendmail command
I want to send a mail from command line, I am using sendmail command for the same.
I tried sending mails to myself. I am able to send mails but, i don't know how to specify Subject line.
echo "Disk Report of `hostname` as of `date`" 2> /dev/null > diskreport
df >> diskreport
sendmail " trilok.prasad@gmail.com < diskreport
How can Subject line be specified?
Thanks
Trilok PVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2009 09:11 AM
тАО10-08-2009 09:11 AM
Re: Subject line with the sendmail command
# mailx -s "Disk Report for $(hostname)" myemail@mycompany.com < diskreport
Note the '-s' argument and the use of 'mailx'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2009 09:14 AM
тАО10-08-2009 09:14 AM
Re: Subject line with the sendmail command
The mailx is working in hp unix servers, same scripts with mailx -s is working in hp unix servers. mailx is not working in linux postfix relay pc. sendmail is working and i am getting the mail without subject.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2009 10:02 AM
тАО10-08-2009 10:02 AM
Re: Subject line with the sendmail command
Sendmail isn't intended at a user interface. You can type, line-for-line something like:
sendmail myemail@mycompany.com
Subject: myrepot
This is the body of my message
^D
...Note the line that begins with "Subject:" triggers the subject line. The ^D is a control_D which signifies end-of-file.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2009 12:25 PM
тАО10-08-2009 12:25 PM
Re: Subject line with the sendmail command
http://www.hpux.ws/?p=6
Take a look at the script in there. It is a bit more than you need but demonstrates how to control the subject.
You can also use the script to attach a file to an email, delivering your report that way.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2009 12:40 PM
тАО10-08-2009 12:40 PM
Re: Subject line with the sendmail command
OK, this works:
#!/bin/sh
sendmail myemail@mycompany.com <<- EOF!
> Subject: Disk Report from $(hostname)
> $(< /tmp/diskreport)
> EOF!
Again, make sure that the line that begins with "Subject" specifies an uppercase "S" and a colon (:) character as shown.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2009 01:40 AM
тАО10-09-2009 01:40 AM
Re: Subject line with the sendmail command
/usr/bin/printf "%b" "Subject:subject goes here\nFrom:specify.from@address.com\n" $(cat diskreport) | /usr/sbin/sendmail your@mail.com
The $(cat diskreport) will fill the message body. It is possible to substitute it with plain text or other command if required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2009 11:13 AM
тАО10-09-2009 11:13 AM
Re: Subject line with the sendmail command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-09-2009 11:21 AM
тАО10-09-2009 11:21 AM
Re: Subject line with the sendmail command
up2date -i mailx
or
yum install mailx