AIX send mail with HTML message body and a binary attachment


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers AIX send mail with HTML message body and a binary attachment
# 1  
Old 03-15-2007
AIX send mail with HTML message body and a binary attachment

I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements:
1. command line switch to specify file name containing message body in HTML format
2. command line switch to specify file name of a binary attachment
3. command line or input file to specify recipients (both to:, cc: and bccSmilie
4. command line to specify From: address
5. command line to specify mail subject (subject text may include spaces)

I've tried every combination redirecting and piping uuencode and mail/mailx you could ever come up with with no luck.

The stumbling block is the HTML message body. Attaching a binary file to a text message body is a no brainer but I have to have the message body in HTML because we are using formatted tables.

Any help would be greatly appreciated.

Thanks.
# 2  
Old 03-16-2007
Try something like....
Code:
$ cat ./mailheader
To: you@there.com
From: me@here.com
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Subject: Hello
$ cat ./mailbody
<center><h1>Hello</h1></center>
Will this work?<br><b>Yes</b>
$ cat ./mailheader ./mailbody | /usr/lib/sendmail -t

Cheers
ZB
# 3  
Old 03-16-2007
Just read your additional requirement RE: attachment...

Code:
 ( cat ./mailheader ./mailbody && uuencode attachment.txt attachment.txt ) | /usr/lib/sendmail -t

Cheers
ZB
This User Gave Thanks to zazzybob For This Post:
# 4  
Old 03-19-2007
Followed your syntax and while it does send the body of the mail in HTML format it does not add the binary attachment.

Any other suggestions?
# 5  
Old 03-22-2007
Bump.

Any assistance would be greatly appreciated.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unable to send mail with inline html along with attachment. Please help!

The below code is not working. I am able to send only inline html or only attachment. When trying to do both, only inline html is sent without attachment. Please help! #!/bin/ksh (echo "Subject: Test Mail - HTML Format" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

2. Shell Programming and Scripting

send mail from AIX unix with multiple attachment

Hi, I have the below code for sending email from AIX unix. I need the body of the mail should content of errornotify.txt file. i tested with cat errornotify.txt, it is not working...Also i need multiple attachments. Can you please help me out on this. ( echo "From:cus@xxx.xx.com" echo... (3 Replies)
Discussion started by: rsivasan
3 Replies

3. Shell Programming and Scripting

send attachment and body in one mail using mailx

Hi, Our requirement is to send an attachment and content in a single mail. I am using the below command to send attachement. --------------------- (uuencode $exp_file $exp_file) |mailx -s "$email_subject" $EmailRecipients -------------------- I m not able to send any message in the... (4 Replies)
Discussion started by: ashwin3086
4 Replies

4. Red Hat

Send HTML body and HTML attachment using MUTT command

Hi there.. I need a proper "mutt" command to send a mail with html body and html attachment at a time. Also if possible let me know the other commands to do this task. Please help me.. (2 Replies)
Discussion started by: vickramshetty
2 Replies

5. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

6. Shell Programming and Scripting

Sendmail with html attachment and html body

Hi folks, I have a perl script which sends out email after successful completion of job as inline html, I want to send it out as two parts now as html inline and html attachment. see the attached script. Thanks in advance (1 Reply)
Discussion started by: sol_nov
1 Replies

7. Shell Programming and Scripting

How to send a mail with attachement as well as message Body..?

Hi all, i am working with CSH, i want to know that how to send a mail in UNIX shell script (CSH) with attachment as well as message body. i know that how to send a mail with attachment and message body. but i want know both things in a single mail Suggession would be appreciate. ... (1 Reply)
Discussion started by: psiva_arul
1 Replies

8. AIX

Command line/Script to send E-mail with HTML body and binary attachment

I apoligize for the cross-post but I'm not getting much in the way of help in the dummies forum: I'm trying to script sending an e-mail message on an AIX 5.x server with the following requirements: 1. command line switch to specify file name containing message body in HTML format 2. command... (3 Replies)
Discussion started by: G-Man
3 Replies

9. Shell Programming and Scripting

Send an attachment and html text both in the same mail

Hi all, I am working on UNIX (Solaris28). I would like to send an email in which the body will be in html format and, in the same mail, a xls file has to be attached. I have tried this: the file is correctly attached but the body comes as html source and not formatted. If I do not attach the... (4 Replies)
Discussion started by: stefan.yu
4 Replies

10. AIX

How to send a mail with an attachment from AIX 5.2 OS?

Has anyone written a script to attach a file when sending an email using the mailx command? (1 Reply)
Discussion started by: mintu41
1 Replies
Login or Register to Ask a Question