Sponsored Content
Top Forums UNIX for Advanced & Expert Users display HTML text in body using unix mailX ???? Post 302219736 by era on Wednesday 30th of July 2008 01:23:13 AM
Old 07-30-2008
You don't really need Perl for that, either. And you should make sure there is an empty line between the headers and the body.

Code:
( cat <<HERE; cat /path/to/file.html) | sendmail -oi -t
From: sender@example.com
To: recipients@example.net
Subject: We hate you, so we send HTML instead of plain text
Mime-Version: 1.0
Content-type: text/html
Content-transfer-encoding: 8bit

HERE

You should properly have Mime-Version and Content-Transfer-Encoding headers as well as Content-Type. The issue of correct MIME transfer encoding is one of the many possible complexities which is simply ignored here (and one of the reasons simple shell scripts don't work well in the general case).

If your cat can combine standard input with a regular file, more power to you.

Code:
cat - /path/to/file.html <<HERE | sendmail -oi -t
...

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How can I write a HTML file in UNIX and sent it as a body of a mail

Hi, How can I write a HTML file in Unix. Once I do that, I want to send this file as a body of a mail, along with writing a subject for the mail I am sending through unix. How can that be done? (0 Replies)
Discussion started by: diwa81
0 Replies

2. UNIX for Dummies Questions & Answers

mailx and html body messages

Hi, I'm working on Solaris 9 (SPARC) and I like to send an html body message to our users when something happen. The problem is that I can't find how to give mime type information with mailx. To be recognized as html I need to put in email header this information: Mime-Version: 1.0... (2 Replies)
Discussion started by: gbagagli
2 Replies

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

4. Shell Programming and Scripting

Referring to attached images in html email body through mailx

encoding type for images? (5 Replies)
Discussion started by: biswasbaishali
5 Replies

5. Shell Programming and Scripting

mailx requirement - email body header in bold and data content in normal text

Dear all- I have a requirement to send an email via email with body content which looks something below- Email body contents -------------------- RequestType: Update DateAcctOpened: 1/5/2010 Note that header information and data content should be normal text.. Please advice on... (5 Replies)
Discussion started by: sureshg_sampat
5 Replies

6. Shell Programming and Scripting

Display o/p in HTML format from unix environment

Hi, i want to disply the o/p in HTML format from unix environment. Let me explain my requirement. First an automated email should be sent in HTML format. The report contains number of error on a daily basis for this week. email looks like below, 01-04-2010 1000 02-04-2010 ... (3 Replies)
Discussion started by: apsprabhu
3 Replies

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

8. Shell Programming and Scripting

Display both html and plain text in email in shell script

Hi, I want to display both html and plain in email in my script. i tried the below code code: export MAILTO="ssi@a.com" export CONTENT1="$htmlfile" export CONTENT2="$plainfile" export SUBJECT="INFO " export MAILFROM="si@a.com" ( echo "Subject: $SUBJECT" echo "MIME-Version:... (4 Replies)
Discussion started by: sreelu
4 Replies

9. UNIX for Advanced & Expert Users

Mutt for html body and multiple html & pdf attachments

Hi all: Been racking my brain on this for the last couple of days and what has been most frustrating is that this is the last piece I need to complete a project. There are numerous posts discussing mutt in this forum and others but I have been unable to find similar issues. Running with... (1 Reply)
Discussion started by: raggmopp
1 Replies

10. 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
Mail::DKIM::Canonicalization::Base(3)			User Contributed Perl Documentation		     Mail::DKIM::Canonicalization::Base(3)

NAME
Mail::DKIM::Canonicalization::Base - base class for canonicalization methods SYNOPSIS
# canonicalization results get output to STDOUT my $method = new Mail::DKIM::Canonicalization::relaxed( output_fh => *STDOUT, Signature => $dkim_signature); # add headers $method->add_header("Subject: this is the subject1512"); $method->finish_header(Headers => @all_headers); # add body $method->add_body("This is the body.1512"); $method->add_body("Another two lines1512of the body.1512"); $method->finish_body; # this adds the signature to the end $method->finish_message; CONSTRUCTOR
Use the new() method of the desired canonicalization implementation class to construct a canonicalization object. E.g. my $method = new Mail::DKIM::Canonicalization::relaxed( output_fh => *STDOUT, Signature => $dkim_signature); The constructors accept these arguments: Signature (Required) Provide the DKIM signature being constructed (if the message is being signed), or the DKIM signature being verified (if the message is being verified). The canonicalization method either writes parameters to the signature, or reads parameters from the signature (e.g. the h= tag). output If specified, the canonicalized message will be passed to this object with the PRINT method. output_digest If specified, the canonicalized message will be added to this digest. (Uses the add() method.) output_fh If specified, the canonicalized message will be written to this file handle. If none of the output parameters are specified, then the canonicalized message is appended to an internal buffer. The contents of this buffer can be accessed using the result() method. METHODS
add_body() - feeds part of the body into the canonicalization $method->add_body("This is the body.1512"); $method->add_body("Another two lines1512of the body.1512"); The body should be fed one or more "lines" at a time. I.e. do not feed part of a line. finish_header() - called when the header has been completely parsed $method->finish_header(Headers => @all_headers); Formerly the canonicalization object would only get the header data through successive invocations of add_header(). However, that required the canonicalization object to store a copy of the entire header so that it could choose the order in which headers were fed to the digest object. This is inefficient use of memory, since a message with many signatures may use many canonicalization objects and each canonicalization object has its own copy of the header. The headers array is an array of one element per header field, with the headers not processed/canonicalized in any way. result() my $result = $method->result; If you did not specify an object or handle to send the output to, the result of the canonicalization is stored in the canonicalization method itself, and can be accessed using this method. SEE ALSO
Mail::DKIM AUTHOR
Jason Long, <jlong@messiah.edu> COPYRIGHT AND LICENSE
Copyright (C) 2006-2007 by Messiah College This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available. perl v5.16.3 2010-11-14 Mail::DKIM::Canonicalization::Base(3)
All times are GMT -4. The time now is 03:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy