- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- send mail with embedded html plus .xls attachment
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
тАО02-28-2011 01:07 PM
тАО02-28-2011 01:07 PM
send mail with embedded html plus .xls attachment
numerous posts on the forum that discuss variations of this, however I cannot find a solution for this particular scenario.
My .html file looks something like this:
# cat email.html
Sample HTML file
I'm able to send the html formatted email with no attachments using the following code:
cat email.html \
| /usr/lib/sendmail -t "someone@domain.com"
=====================================
When I update the code to include the attachement as follows, the email is sent with the attachment but the email body is missing:
echo "To: $p_email\nSubject: $month $year Subject\n" > $mailfile
(cat email.html; \
uuencode ${ofile1} ${ofile1} >> $mailfile) \
| /usr/lib/sendmail -t < ${mailfile}
=====================================
Next I tried the following and received the inline html email body but the .csv file was corrupt.
export MAILTO=someone@domain.com
export SUBJECT="Test Waiver Code email"
export BODY=email.html
export ATTACH=wcode_hdr.csv
EMAIL_BOUNDARY_STRING=Z${RANDOM}${RANDOM}${RANDOM}${RANDOM}
(
echo "To: $MAILTO"
echo "Subject: $SUBJECT"
echo "MIME-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="${EMAIL_BOUNDARY_STRING}"'
echo '--${EMAIL_BOUNDARY_STRING}'
echo "Content-Type: text/html charset=us-ascii"
echo "Content-Disposition: inline"
cat $BODY
echo '--${EMAIL_BOUNDARY_STRING}'
echo "Content-Transfer-Encoding: base64"
echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
uuencode $ATTACH $(basename $ATTACH)
) | /usr/sbin/sendmail $MAILTO
Any suggestions?
Thanks
- Tags:
- attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-28-2011 01:34 PM
тАО02-28-2011 01:34 PM
Re: send mail with embedded html plus .xls attachment
http://hpux.ws/mailfile2
Try that script.
Change the flipping email address though so my mailbox doesn't get filled.
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
тАО02-28-2011 01:57 PM
тАО02-28-2011 01:57 PM
Re: send mail with embedded html plus .xls attachment
http://hpux.ws/mailfile2
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
тАО02-28-2011 02:02 PM
тАО02-28-2011 02:02 PM
Re: send mail with embedded html plus .xls attachment
Please take a look to attached file.
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 05:25 AM
тАО03-01-2011 05:25 AM
Re: send mail with embedded html plus .xls attachment
It appears your example only sends an email with a file attached. I need to attach a file as well as include inline html for the message body.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 05:30 AM
тАО03-01-2011 05:30 AM
Re: send mail with embedded html plus .xls attachment
Have you reviewed my attachment?
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 05:31 AM
тАО03-01-2011 05:31 AM
Re: send mail with embedded html plus .xls attachment
I tried your example and received the email with the attachement (not corrupted), but the inline html for the message body did not display correctly. It displayed as a single text line of "email.html" instead of the actual verbiage within my file.
I used your code as follows:
MAILTO=someone@domain.com
SUBJECT="Test Waiver Code email"
FROM=host@domain.com
BODY=`cat email.html`
ATTACH=wcode_hdr.csv
#
#And this last one send both of them, inside email body and an attachment:
(echo "Subject:$SUBJECT\nTo: $MAILTO\nImportance:High\n\n$BODY";uuencode $ATTACH $ATTACH)| /usr/sbin/sendmail $MAILTO
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 06:09 AM
тАО03-01-2011 06:09 AM
Re: send mail with embedded html plus .xls attachment
Correction, I see a mistake in my code where I didn't cat the email.html file. I fixed that but still the actual html code with tags is displayed in the email body as opposed to the inline formatted html verbiage.
Lynne
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 06:55 AM
тАО03-01-2011 06:55 AM
Re: send mail with embedded html plus .xls attachment
Try this:
(echo "Subject:$SUBJECT\nTo: $MAILTO\nImportance:High\n\n`cat email.html`";uuencode $ATTACH $ATTACH)|/usr/sbin/sendmail $MAILTO
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 08:47 AM
тАО03-01-2011 08:47 AM
Re: send mail with embedded html plus .xls attachment
I get the same results, the html is not formatted, the email body displays as follows:
Content-Transfer-Encoding: 7bit
Content-Type: text/html charset=us-ascii
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 09:04 AM
тАО03-01-2011 09:04 AM
Re: send mail with embedded html plus .xls attachment
(echo "Subject:$SUBJECT\nTo: $MAILTO\nImportance:High\nContent-Type: text/html; charset=us-ascii\n\n$BODY";uuencode $ATTACH $ATTACH)|/usr/sbin/sendmail $MAILTO
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 09:10 AM
тАО03-01-2011 09:10 AM
Re: send mail with embedded html plus .xls attachment
#Content-Type: text/html Content-Transfer-Encoding: 7bit Content-Type: text/html charset=us-ascii
Hello all,
Please find the February 2011 waiver codes. These waiver codes are intended for your use only and should not be forwarded to any other recipients. Thank you!
begin 644 wcode_hdr.csv M4%)!(%=A:79E
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 11:43 AM
тАО03-01-2011 11:43 AM
Re: send mail with embedded html plus .xls attachment
MAILTO=someone@domain.com
SUBJECT="Test Waiver Code email"
BODY=`email.html`
HTMLFLAG="Content-type: text/html; charset=us-ascii\Content-Transfer-Encoding: 7bit\nMIME-Version: 1.0"
(echo "Subject:$SUBJECT\nTo:$MAILTO\nImportance:High\n$HTMLFLAG\n\n$BODY")|/usr/sbin/sendmail -t
Rgds.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 11:57 AM
тАО03-01-2011 11:57 AM
Re: send mail with embedded html plus .xls attachment
Content-Disposition: inline
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
Content-Disposition: attachment; filename="'$(basename wcode_hdr.csv)'"
I've been told it works on AIX using the -m flag with sendmail, but that flag is not available on HP-UX. There must be something comparable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 12:20 PM
тАО03-01-2011 12:20 PM
Re: send mail with embedded html plus .xls attachment
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-01-2011 01:25 PM
тАО03-01-2011 01:25 PM
Re: send mail with embedded html plus .xls attachment
#man uuencode (is the same to uudecode)
You must select the most convenient way to send it, as part of email body or an attached file. We worked for it!
If you have felt assisted please do not forget assign points!
Best regards