mailing with both data and attachment


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mailing with both data and attachment
# 1  
Old 07-31-2012
Error mailing with both data and attachment

Hi all,
for sending mail in shell script am using mailx command but am un able to send both the data and attachment can any one please help me am using the following command

Code:
ux2dos $ChangeList.xls | uuencode ChangeList.xls | cat $stroutfile | mailx -m -s "This is a test" test@test.com

I need the mail in the following format
Code:
<some data>
<some data>
<some data>
<some data>
<some data>
<then file as a attachment>

# 2  
Old 08-01-2012
you could try this using sendmail:

Code:
( echo "to: test@test.com"
  echo "from: jhon1257@elsewhere.com"
  echo "subject: This is a test"
  echo "mime-version: 1.0"
  echo "content-type: multipart/related; boundary=xxxRANDOMSTRINGxxx"
  echo
  echo "--xxxRANDOMSTRINGxxx"
  echo "content-type: text/plain"
  echo
  echo "<some data>"
  echo "<some data>"
  echo "<some data>"
  echo
  echo "--xxxRANDOMSTRINGxxx"
  echo "content-type: image/gif; name=ChangeList.xls"
  echo "content-transfer-encoding: base64"
  echo
  ux2dos $ChangeList.xls | uuencode ChangeList.xls ) | sendmail -t -i

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need syntax for mailing in UNIX by using html file as body and along with attachment

Hi All, I need a syntax for mailing in unix by using html code file output as body and along with attachment (without using mutt command) HTML code file : html1.txt Attachment : attach1.txt I was using the below codes but they are not working. ( cat html1.txt ; uuencode attach1.txt... (4 Replies)
Discussion started by: Rokkesh
4 Replies

2. Solaris

Sent an email attachment, but the attachment is empty

I'm trying to send a .zip file from my unix box to my work email (email client outlook) The file name that I'm trying to sent is sites.zip and this is how I do it: uuencode sites.zip | mailx -s "testing" myname@mydomain.com When I open the .zip, the zip is empty. Looking around the we, I... (17 Replies)
Discussion started by: amb1s1
17 Replies

3. Shell Programming and Scripting

Excel file attachment showing data in single column

Hi All, found similar posts, but not exatcly what i wanted. I have an text file like below and am trying to send mail as an excel file but when i get the excel file as the attachment, all the data is coming in the first column. I need below data in 4 columns. Unix file Name,ID,Trade,Date... (3 Replies)
Discussion started by: robinbannis
3 Replies

4. UNIX for Advanced & Expert Users

attachment with mailx sometimes result in data confusion [not reproducable]

Hi Ich have a script with SQL*Plus what sends a *.csv to serveral people using M$ Outlook. $ grep mailx report.sh (cat /opt/tmp/MSG.txt ; uuencode $data_report report.csv ) | mailx -s "Report" -r xx@xxx.com yyy@yyy.com zzzz@zzzzz.org On a Solaris box: $ uname -a SunOS hostname 5.10... (2 Replies)
Discussion started by: slashdotweenie
2 Replies

5. Shell Programming and Scripting

Adding an attachment as an attachment to mailx

I don't want the attachment embedded in the mail. I would like a file attached. When I do mailx -s "Report, `date +'%D %r` " -r "Notifications" bob@bob.com < /usr/local/bin/myreport.log> /dev/null It gets embedded in my email. I want a file attachment. How do I do that? (2 Replies)
Discussion started by: guessingo
2 Replies

6. Shell Programming and Scripting

mailing a data from ksh

I need to send below email from ksh --------------------------- Subject:- Action Required Email Body:- Please do this activity $variable ---------------------------- But the problem is while sending the mail,I have to take care of alignment of the text also. The row and column i.e... (1 Reply)
Discussion started by: punitpa
1 Replies

7. UNIX for Dummies Questions & Answers

Mailing attachment stops at 199K

Hi, I have a script which part of it mails an attachment. The command is uuencode $v_file_name.zip "output.zip" | mailx -s "$v_subject" $v_to_email There is a problem that it only sends 199K of an attachment. Is there a reason why it would stop at 199K? I've search the net and nothing... (2 Replies)
Discussion started by: m1l
2 Replies

8. UNIX for Dummies Questions & Answers

Mailing an attachment

Hi, I need to compress (zip) a flat file and mail the same as an attachment. I had tried the following piece of code. But when i open the attachment in mail, the data is incorrect (displays all junk characters). tar cf abc.tar abc.txt compress abc.tar uuencode abc.tar.Z abc1.wri | mailx... (4 Replies)
Discussion started by: gayath3
4 Replies

9. Shell Programming and Scripting

Mailing an attachment

Hi, I need to compress (zip) a flat file and mail the same as an attachment. I had tried the following piece of code. But when i open the attachment in mail, the data is incorrect (displays all junk characters). tar cf abc.tar abc.txt compress abc.tar uuencode abc.tar.Z abc1.wri | mailx -s... (0 Replies)
Discussion started by: gayath3
0 Replies

10. UNIX for Dummies Questions & Answers

Mailing an attachment

Hi, I'm fairly new to using Unix and I was just wondering can someone please tell me the simplest way to mail and attachement using the mail command using Solaris? I have tried using uuencode file name | mail johndoe@ttp.ie but it hasn't worked. I have been mailing the file to myself using... (4 Replies)
Discussion started by: gerwhelan
4 Replies
Login or Register to Ask a Question