The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com



HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to attach a file in Linux mail command rohit22hamirpur Shell Programming and Scripting 1 12-05-2008 01:58 AM
How to attach a file & send mail thru script Mar1006 Shell Programming and Scripting 9 10-12-2006 08:54 AM
Need to attach a txt file while sending mail charan81 Shell Programming and Scripting 9 01-12-2006 01:44 AM
How to attach an excel file/ dat file thru unix mails diwakar82 Shell Programming and Scripting 1 01-06-2006 11:23 AM
How to attach a file in mail? firebirdonfire UNIX for Dummies Questions & Answers 1 03-29-2001 07:38 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-27-2009
elcampio elcampio is offline
Registered User
  
 

Join Date: Jul 2009
Posts: 1
How to attach an excel file in a multipart (mime) mail

Hello.

I need to send mails from hp-ux with 2 attachments: a text file and an excel file. So I'm composing a mime file which I will pipe to sendmail utility.

This works fine if the only attachment is the text file (i use cat command to attach text content). But I have problems with the format when I try to open the sent excel file. I have tried cat, uuencode, od... I've changed the 'encoding' (binary, base64, etc).

My code is like this (progress environment, put is like echo):

put "------------thisss isss aaa boundddaaarrryyy" skip.
put 'Content-Type: text/plain; charset=us-ascii; name="' (p_filename + '"') format "x(30)" skip.
put "Content-Transfer-Encoding: 7bit" skip.
put 'Content-Disposition: attachment; filename="' (p_filename + '"') format "x(30)" skip(1).
unix silent cat value(p_filepath).

put "------------thisss isss aaa boundddaaarrryyy" skip.
put 'Content-Type: application/octet-stream; name="' (p_filename2 + '"') format "x(30)" skip.
put "Content-Transfer-Encoding: base64" skip.
put 'Content-Disposition: attachment; filename="' (p_filename2 + '"') format "x(30)" skip(1).
unix silent uuencode value(p_filepath2) value(p_filepath2).



The output file (mime.txt) is piped to sendmail like this:
par = '-F"' + p_fullname + '" -bm -t -rxxxxx@xxxxx.com'.
unix silent cat ./tmp_cnt_mime.txt | /usr/sbin/sendmail value(par)


Any idea??
Does anyone know another solution??
  #2 (permalink)  
Old 07-29-2009
shamrock shamrock is offline Forum Advisor  
Registered User
  
 

Join Date: Oct 2007
Location: USA
Posts: 750
Only way I know is to create a csv file and save it with a .csv extension and then attach it to mailx with the uuencode utility...
Code:
echo "hello,world" > file.csv
uuencode file.csv file.csv | mailx -m -s "Excel file" your_email_addr
  #3 (permalink)  
Old 08-01-2009
Bill L. Bill L. is offline
Registered User
  
 

Join Date: Aug 2009
Location: richmond VA
Posts: 3
give this a try

if you can follow - automatic date - for last month
probably a better way - take a look

ext=_FINAL_s
space=_
year=$(date +%Y)
month=$(date +%m)
monthh=$(date +%h)
day=$(date +%d)

month=$(($month-1))
if [ $month -lt 1 ]
then
year=$(($year-1))
month=12
fi

if [ $month -eq 1 ]
then monthd=JAN
elif [ $month -eq 2 ]
then monthd=FEB
elif [ $month -eq 3 ]
then monthd=MAR
elif [ $month -eq 4 ]
then monthd=APR
elif [ $month -eq 5 ]
then monthd=MAY
elif [ $month -eq 6 ]
then monthd=JUN
elif [ $month -eq 7 ]
then monthd=JUL
elif [ $month -eq 8 ]
then monthd=AUG
elif [ $month -eq 9 ]
then monthd=SEP
elif [ $month -eq 10 ]
then monthd=OCT
elif [ $month -eq 11 ]
then monthd=NOV
elif [ $month -eq 12 ]
then monthd=DEC
fi

echo $day
echo $month
echo $monthd

uuencode CP_template_$monthd$space$year$ext.xls < /cqdata10/data_0/CP_template_$
monthd$space$year$ext.html | mailx -m -s "SPECIAL Auto. e-mail - C/P - dq Stats
- for month end $monthd $year - file should be att. - from UNIX "william.g.loughran@yourcompany.com"
  #4 (permalink)  
Old 08-23-2009
defk3000 defk3000 is offline
Registered User
  
 

Join Date: Aug 2009
Posts: 1
Install Perl and the module MIME::Lite. Then you can just build your message and add the attachment with the correct mime information to be sent out.
It would really only take a couple of lines and give you the ability to write some code with flexibility to use in other situations.
Reply

Bookmarks

Tags
mime attachment

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:12 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0