Sponsored Content
Top Forums Shell Programming and Scripting Problem in sending inline html with an attachment using sendmail Post 302533571 by jayan_jay on Friday 24th of June 2011 05:16:03 AM
Old 06-24-2011
Try this..

Code:
echo "To: <mail-id's>" >> output_file
echo "Subject: <subject content>" >> output_file
echo "Mime-Version: 1.0" >> output_file
echo 'Content-Type: multipart/mixed; boundary="GvXjxJ+pjyke8COw"' >> output_file
echo "Content-Disposition: inline" >> output_file
echo "" >> output_file
echo "--GvXjxJ+pjyke8COw" >> output_file
echo "Content-Type: text/html" >> output_file
echo "Content-Disposition: inline" >> output_file
cat <your inline text content> >> output_file
echo "" >> output_file
echo "--GvXjxJ+pjyke8COw" >> output_file
echo "Content-Type: text/plain" >> output_file
echo "Content-Disposition: attachement; filename=<attachment file with extension>" >> output_file
echo "" >> output_file
echo "" >> output_file
cat <attachment file> >> output_file
cat output_file | /usr/lib/sendmail -t


Last edited by pludi; 06-24-2011 at 08:25 AM..
These 2 Users Gave Thanks to jayan_jay For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sending HTML attachment through mail

Hi I am new to unix and scripting.I am trying to send a html file as an attachment. SUBJECT="Type of Exceptions in Application" TO=Sushovan.Samals@gmail.com SPOOLFILE=/data/reg/tlogs/Monitor.html #echo "Send the E-mail message..." uuencode $SPOOLFILE $SPOOLFILE | mailx -s "$SUBJECT" $TO... (2 Replies)
Discussion started by: sushovan
2 Replies

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

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

4. Shell Programming and Scripting

Sendmail with HTML body and attachment

I have an HTML file I am currently sending in the body of an email. I now have a need to send a csv attachment along with it. I can ONLY use sendmail as mutt and xmail etc are not on the server. Here is what I am currently using: It is possible to add code to add an attachment ??!? { ... (8 Replies)
Discussion started by: atelford
8 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

Sending a csv attachment and html text together.

Hello, I need to send below text (in a file ABC)as html text in mail body and the same as csv attachment 1,2,3 4,5,6 7,8,9 but to send as html text in mailbody we use echo "Subject: Report " | cat - ABC | /usr/lib/sendmail -t a@xyz.com and to send as an attachment in csv format we... (9 Replies)
Discussion started by: skhichi
9 Replies

7. Shell Programming and Scripting

problem with sending mail from txt file having HTML code via sendmail -t

Hi, i have the following code in shell named as test3.sh.. #!/bin/sh . /home/<user>/.profile export dt=`date "+%d%b%y"` export tim=`date "+%d%b%y %HM:%MM"` cd export WD=`pwd` SID="<sid>" export SID export ORACLE_SID=$SID export ORACLE_HOME=/oracle/$SID/102_64 export... (4 Replies)
Discussion started by: jassi10781
4 Replies

8. Shell Programming and Scripting

Sending attachment using sendmail command

Send_Mail() { C_Date=`date +"%m/%d/%Y"` #Subject="MMDB Load Job Status" for i in `cat $Metafile` do if then email_address=`echo $i | cut -d":" -f2` /usr/lib/sendmail "$email_address" < $Email_File fi done } this is the send mail command i am using .please let me... (1 Reply)
Discussion started by: Alok K Yadav
1 Replies

9. Shell Programming and Scripting

Need help in sending html mail with attachment

Hi Everyone, I am facing problems in sending html mail with attachemnt. I will able to send mail with attachment (plain text ) using mailx -s and uuencode command and also html mail without attachment using sendmail option. However I am not able to send html mail along with attachment.Either... (2 Replies)
Discussion started by: karthik adiga
2 Replies

10. Shell Programming and Scripting

Sendmail cmd for html body and attachment not working

Hi, I am having trouble in sending a mail with html body and attachment (csv file). We don't have uuencode or mutt (not allowed to install as well) The below code is perfectly working for sending the html body alone: export MAILTO=abc@xyz.com export CONTENT="/home/abc/list.html"... (2 Replies)
Discussion started by: close2jay
2 Replies
Mojo::Content::MultiPart(3pm)				User Contributed Perl Documentation			     Mojo::Content::MultiPart(3pm)

NAME
Mojo::Content::MultiPart - HTTP 1.1 multipart content container SYNOPSIS
use Mojo::Content::MultiPart; my $multi = Mojo::Content::MultiPart->new; $multi->parse('Content-Type: multipart/mixed; boundary=---foobar'); my $single = $multi->parts->[4]; DESCRIPTION
Mojo::Content::MultiPart is a container for HTTP 1.1 multipart content as described in RFC 2616. EVENTS
Mojo::Content::Multipart inherits all events from Mojo::Content and can emit the following new ones. "part" $multi->on(part => sub { my ($multi, $single) = @_; ... }); Emitted when a new Mojo::Content::Single part starts. $multi->on(part => sub { my ($multi, $single) = @_; return unless $single->headers->content_disposition =~ /name="([^"]+)"/; say "Field: $1"; }); ATTRIBUTES
Mojo::Content::MultiPart inherits all attributes from Mojo::Content and implements the following new ones. "parts" my $parts = $multi->parts; $multi = $multi->parts([]); Content parts embedded in this multipart content, usually Mojo::Content::Single objects. METHODS
Mojo::Content::MultiPart inherits all methods from Mojo::Content and implements the following new ones. "new" my $multi = Mojo::Content::MultiPart->new; Construct a new Mojo::Content::MultiPart object and subscribe to "read" event with default content parser. "body_contains" my $success = $multi->body_contains('foobarbaz'); Check if content parts contain a specific string. "body_size" my $size = $multi->body_size; Content size in bytes. "build_boundary" my $boundary = $multi->build_boundary; Generate a suitable boundary for content. "clone" my $clone = $multi->clone; Clone content if possible, otherwise return "undef". "get_body_chunk" my $chunk = $multi->get_body_chunk(0); Get a chunk of content starting from a specfic position. "is_multipart" my $true = $multi->is_multipart; True. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Content::MultiPart(3pm)
All times are GMT -4. The time now is 03:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy