- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- mailx to send html mail
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
тАО05-09-2004 02:36 PM
тАО05-09-2004 02:36 PM
I want to send the mail in html format but end up it show all the HTML source in my outlook. Apart from that I also notice the case statement didn't work at all. No matter it is friday or saturday all mail seem to send using the SEND_TO instead of SEND_TO_WEEKEND
DAY=`date '+%A'`
case $DAY in
Monday|Tuesday|Wednesday|Thursday|Friday)
mailx -r $SEND_FROM -s $REPORT_TITLE $SEND_TO < $FILE ;;
Saturday|Sunday)
mailx -r $SEND_FROM -s $REPORT_TITLE $SEND_TO_WEEKEND < $FILE
esac
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2004 02:56 PM
тАО05-09-2004 02:56 PM
Re: mailx to send html mail
For example
MYVAR=ABC/BCD
MYVAR="bgcolor ="#ffffff""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2004 03:03 PM
тАО05-09-2004 03:03 PM
SolutionDAY=`date '+%A'`
case "$DAY" in
Monday|Tuesday|Wednesday|Thursday|Friday)
mailx -r $SEND_FROM -s $REPORT_TITLE $SEND_TO < $FILE
;;
Saturday|Sunday)
mailx -r $SEND_FROM -s $REPORT_TITLE $SEND_TO_WEEKEND < $FILE
;;
esac
Enclose Day as shown basically and put the ;;
on the following line is the difference. Also you did not terminate your second case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2004 02:04 AM
тАО05-10-2004 02:04 AM
Re: mailx to send html mail
As for the other problem, you might need to add some lines so that Outlook understands it is HTML. It has to be something like this:
content-type: text/html
This has to be the top line. To be sure it is parsed correctly, also add 2 blank lines after the content-type line.
The problem is, mailx already creates a content-type line. The command mail doesn't, but will not create a subject. This can be solved by adding a -m option, which will not put in the MIME type of the message. Also, you still need to insert the content-type in the header. Putting it in as first line in the text, doesn't work... But there is a solution I found:
mailx -m -r $SEND_FROM -s "$REPORT_TITLE
Content-type: text/html" $SEND_TO <$FILE
should work... The new-line in the subject is accepted by mailx, and will put the content-type on a new line in the header, which Outlook will accept...
Not the nicest solution, but this works with the tools you have, at least.
But perhaps it's time to think about other, more suitable tools...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2004 10:28 AM
тАО05-10-2004 10:28 AM
Re: mailx to send html mail
We send several html reports daily, but do so using mailx. The attachment comes in through Outlook as an html without problem.
i.e.
uuencode OUTPUT_FILE.html OUTPUT_FILE.html | mailx -s "Netbackup Nightly Jobs Report" somone.ofinterest@somewhere.com
I believe your case statement problem has already been addressed.
Best regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2004 12:54 AM
тАО05-11-2004 12:54 AM
Re: mailx to send html mail
The var $TMPFILE is the file with all the stats information as well as embedded html codes.
I create a header file to pass to sendmail with the routing information. The Content-type line tells my email client that this is an html doc, and to display it as such in my quick view window. I don't have to open each email to actually view it, I can just hightlight the subject line and read the message body.
echo "To: sysadm
Subject: $TMPFILE
Content-type: text/html; charset=us-ascii
MIME-Version: 1.0
" > $HEADERFILE;
(cat $HEADERFILE; cat $TMPFILE) | /usr/sbin/sendmail -t -v;
Be sure to have a blank line at the end of the header file.
Hope this helps...