Sponsored Content
Top Forums Shell Programming and Scripting Construct and Send Multipart MIME Mail Post 302909164 by kirankumar on Tuesday 15th of July 2014 04:01:42 AM
Old 07-15-2014
Construct and Send Multipart MIME Mail

Hi,

I have requirment in shell script to incorporate multipart email with both html and text.

Here am giving the text version.

Code:
From: any@email.com
To: your@email.com
Subject: Success Execution - $company - Apps PO File Report


Apps PO File Report 

Summary:
#APPS Purchase order FIle#
Filename: 			/user/files/apps-po/samplefile.txt
Folder: 			./apps-po/
Time started		2014/07/10 03:12:31
Time completed	       2014/07/10 03:12:32

Details:
 Records present on file:           	8
 Records Skipped:             		1
 Records considered for staging:    	7
 Records Rejected:            		2
 Records Discarded:           		0
 Records Loaded into Staging		5

Here am giving the html version

Code:
<body>
From: any@email.com<br/>
To: your@email.com<br/>
Subject: Success Execution - $company - Apps PO File Report <br/><br/>

Apps PO File Report 

<hr/>
<b>Summary:</b>
<br/>
#APPS Purchase order FIle# <br/>
Filename: 			/user/files/apps-po/samplefile.txt<br/>
Folder: 			./apps-po/<br/>
Time started		2014/07/10 03:12:31<br/>
Time completed	2014/07/10 03:12:32<br/>

<br/>
<b>Details:</b>
<br/>
 Records present on file:           8<br/>
 Records Skipped:             		1<br/>
 Records considered for staging:    7<br/>
 Records Rejected:            		2<br/>
 Records Discarded:           		0<br/>
 Records Loaded into Staging		5<br/>
<br/>
</body>

I developed the .ksh script and here am giving the script

Code:
to="any@email.com"
from="your@email.com"
boundary=$(uuidgen -t)
now=$(date +"%a, %d %b %Y %T %z")

cat > pomsg.txt <<EOF2
From: ${from}
To: ${to}
Date: ${now}
Subject: This is a test multipart message
MIME-Version: 1.0
Content-Type: multipart/alternative;boundary=${boundary}


This is a text message.     --> Here am going to incorporate text version

--${boundary}
Content-type: text/html;charset=utf-8


<!DOCTYPE html>
<body>
<pre>
Hello,
 
This is a html version.     --> here am going to incorporate html version

Regards...
</pre>
<body>

--${boundary}--
EOF2
sendmail -i -t < pomsg.txt
sc=$?
echo "sedmail rc=${rc}"
if [[ $sc -eq 0 ]]; then
	rm -i pomsg.txt
fi

it should send you the html email if your email browser accepts html. If not, you’ll see the text version. Could you please help me how to incorporate html and text version in the above .ksh script.

Pls. help me in advance

thanks

Last edited by Scrutinizer; 07-15-2014 at 05:56 AM.. Reason: Added CODE tags; removed MAILTO tags
kirankumar
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using MIME to send html files

:confused: I am a programmer, but need to work with UNIX in this particular situation. I am used to the plain "mail -s" command and also familiar with how to send attachments in html... but I now need to send an email (not an attachment) in html format so I can embed links... etc. I am told... (2 Replies)
Discussion started by: cgardiner
2 Replies

2. Shell Programming and Scripting

how to send mail in UNIX using MIME

Hi, I am searching for an option to send mail with multiple attachments using unix. I know uuencode option, but I dont have the executable in our machines. So I am looking for some other option to do this. And I heard that we can send mails using MIME. Can anyone help me with the syntax and... (2 Replies)
Discussion started by: srilaxmi
2 Replies

3. Shell Programming and Scripting

Script to Convert HTML to MIME mail -- HELP!

Hi: I have writed a script that read a HTML file and convert this in a multipart mime fail to send in a mail. But the result isn't interpreted lika a mime file!! Somebody can see the error??? --------------------------- #! /bin/bash SB=$1 IF=$2 OF=$3 rm -f $OF.b64 ... (7 Replies)
Discussion started by: sushisan
7 Replies

4. HP-UX

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... (3 Replies)
Discussion started by: elcampio
3 Replies

5. UNIX for Advanced & Expert Users

Issue in Curl to send http POST request with attachment/multipart

Hi, I am using curl to hit a url using http in solaris 10 using commandline, I want to transfer an attachment(using multipart curl -F) also as a part of the request. If anyone has used kindly help me with the syntax. I am using below command: Code: /usr/local/bin/curl -v... (1 Reply)
Discussion started by: manishmaha
1 Replies

6. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

7. Shell Programming and Scripting

MIME - HTML mail with Excel attachment - Please help!

#!/bin/ksh ( echo "MIME-Version: 1.0" echo "Content-Type: multipart/mixed; boundary=frontier" echo "--frontier" echo "Content-Type: text/html" echo "Content-Disposition: inline" echo "\n" echo "<html><body><h1>this is html formatted text</h1></body></html>" echo "--frontier" echo... (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

8. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies
WWW::Topica::Reply(3pm) 				User Contributed Perl Documentation				   WWW::Topica::Reply(3pm)

NAME
WWW::Topica::Index - parse a single Topic mailing list index SYNOPSIS
my $index = WWW::Topic::Index->new($index_html); foreach my $message_id ($index->message_ids) { # the mail has some information and also provides a link to the reply ... my $mail = WWW::Topica::Mail->new($topica->fetch_mail($mess_id), $mess_id); # which has other information (like the un-htmled mail and the email address) ... my $reply = WWW::Topica::Reply->new($topica->fetch_reply($mail->id, $mail->eto), $mail->id, $mail->eto); } print "Next offset is ".$index->next." "; print "Previous offset is ".$index->prev." "; DESCRIPTION
Used to parse a single reply page from Topica.com's mailing list indexes. Reply pages have the body of the email (albeit quoted) and potentially a full email address. METHODS
new <page html> <message id> <eto> Takes the html of the page, the eto and the message-id and parses the html. parse <html> Parse the html to get the subject, email address and body of the email. id Get the message id eto Get the message eto email Get the email address parsed out. subject Get the email subject parsed out. body Get the email body parsed out. AUTHOR
Simon Wistow <simon@thegestalt.org> COPYRIGHT
Copyright (c) 2004, Simon Wistow perl v5.10.1 2006-01-03 WWW::Topica::Reply(3pm)
All times are GMT -4. The time now is 03:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy