html format email with attachment in unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting html format email with attachment in unix
# 1  
Old 08-19-2011
html format email with attachment in unix

Team,

I have the below code, which is working fine and it sends the html report using sendmail command.

I want to attach one more file ( which goes as attachment ) in that email. How to achieve it.

i tried with uuencode. But no luck Smilie

Code:
 
outputFile="/tmp/out.html"  
(  
echo "From: abc@abc.com"  
echo "To: abc@abc.com"  
echo "MIME-Version: 1.0"  
echo "Subject: Test"   
echo "Content-Type: text/html"   
cat $outputFile  
) | sendmail -t

# 2  
Old 08-19-2011
try this..

Code:
outputFile="/tmp/out.html"  
attachFile="/tmp/attach.html"
(
echo "From: abc@abc.com" 
echo "To: abc@abc.com"
echo "Subject: Test"
echo "Mime-Version: 1.0"
echo 'Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"'
echo "Content-Disposition: inline" 
echo "" 
echo "--GvXjxJ+pjyke8COw" 
echo "Content-Type: text/html"
echo "Content-Disposition: inline"
cat $outputFile
echo "" 
echo "--GvXjxJ+pjyke8COw"
echo "Content-Type: text/plain"
echo "Content-Disposition: attachement; filename=attachment_filename.html"
echo "" 
cat $attachFile
) | /usr/lib/sendmail -t

These 4 Users Gave Thanks to jayan_jay For This Post:
# 3  
Old 08-19-2011
Thanks jay, will check and let u know
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. HP-UX

Unable to send attachment with html tables in UNIX shell script

Heyy, any help would be grateful.... LOOKING FOR THE WAYS TO SEND AN EMAIL WITH ATTACHMENT & HTML TABLES IN BODY THROUGH SHELL SCRIPT (LINUX)..NOT SURE, IF WE HAVE ANY INBUILT HTML TAG OR UNIX COMMAND TO SEND THE ATTACHMENTS. KINDLY HELP below is small script posted for our understanding..... (2 Replies)
Discussion started by: Harsha Vardhan
2 Replies

2. UNIX for Advanced & Expert Users

Reading the Attachment from UNIX email

Hi - How would you read in the attachment from your unix mail account? The attachment is in BASE64 so I need to isolate those lines so I can convert them. The number of lines varies from a few to a few hundred. To complicate matters, the mail box gets non related emails I want to ignore. The lines... (3 Replies)
Discussion started by: Oliver Burns
3 Replies

3. 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

4. Shell Programming and Scripting

How to send email HTML + PDF attachment?

I am attempting to write a script where I can pass in parameters ( to , from, the location of a pdf attachment ) and send an email that has HTML for the body content and a PDF as an attachment. I have failed to achieve this with sendmail and mutt. I recently found this. If there are any... (2 Replies)
Discussion started by: jvsrvcs
2 Replies

5. UNIX for Dummies Questions & Answers

Sending html email with html attachment

Hello, I have a script which is sending an html file as an attachment. #!/usr/bin/ksh export MAILTO="user@company.com" export CONTENT="/usr/tmp/file.html" export SUBJECT="EmailSubject" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (0 Replies)
Discussion started by: sreenathkg
0 Replies

6. Shell Programming and Scripting

Format of content displayed in the attachment of email

Hi, I'm facing a problem in mailing attachments using uuencode in mailx. I got to attach a couple of flatfiles. I'm able to attach and mail the files successfully. But there is a problem in the format of the flatfiles when they are received as an attachemnt. For Example : Consider... (0 Replies)
Discussion started by: Sindhuap
0 Replies

7. UNIX for Advanced & Expert Users

How to send email as HTML format with attachment ?

hi.. Could somebody help me how to sent an attachment using sendmail command and the content is HTML format ?. Below is my code to sent the email as HTML but i do not know how to sent the attachment, please help me To: "BAHARIN HASAN"<baharin.hasan@gmail.com> from: "DATAONE SDN... (4 Replies)
Discussion started by: bh_hensem
4 Replies

8. Shell Programming and Scripting

UNIX file attachment in email

Hi, I have a syntax for mail attachment as $EMAIL "Wrapper $wrapper_script_name has failed" " $wrapper_script_name has Failed " $failed_email_address and $EMAIL is as below MSGSub=${1} MSGText=${2} RMAIL=${3} #set LANG='' export LANG='' echo "${MSGSub}" | mailx -s "${MSGText}" ... (1 Reply)
Discussion started by: satgur
1 Replies

9. Shell Programming and Scripting

Format disorder after email with attachment

Hello My script is to email a textfile(abc) in unix. I open abc.txt using window notepad. All the "Enter Key"(line break) are found missed. However, it is no problem using window wordpad. uuencode abc abc.txt | mailx -s "Email Subject" someone@email.com How can I adjust the above command... (1 Reply)
Discussion started by: on9west
1 Replies

10. Shell Programming and Scripting

send email from unix with attachment

Hello All, This is a common question that I found lot of results in the forums. I am trying to use uuencode to attach a file and send email. I have no issues sending email, but not able to attach any files using sendmail. Is uuencode part of sendmail or does 'uuencode' utility need to be... (1 Reply)
Discussion started by: chiru_h
1 Replies
Login or Register to Ask a Question