If I understand correctly you want to get the content of the file in the email as well as an attachment of the file itself? If so, I used code that Pederabo has written for this and modified it for my use. This will show the content of the file in the email as well as attach the file itself with the email.
Code:
export MAILTO="recipient@domain.com"
export CONTENT="./html/body.html"
export SUBJECT="TEST EMAIL: TESTING HTML"
BOUNDARY='=== This is the boundary between parts of the message. ==='
{
print - "From: Someone <$MAILFROM>"
print - "To: Someone <${MAILTO}>"
print - 'Subject:' $SUBJECT
print - 'MIME-Version: 1.0'
print - 'Content-Type: MULTIPART/MIXED; '
print - ' BOUNDARY='\"$BOUNDARY\"
print -
print - ' This message is in MIME format. But if you can see this,'
print - " you aren't using a MIME aware mail program. You shouldn't "
print - ' have too many problems because this message is entirely in'
print - ' ASCII and is designed to be somewhat readable with old '
print - ' mail software.'
print -
print - "--${BOUNDARY}"
print - 'Content-Type: TEXT/PLAIN; charset=US-ASCII'
print -
cat $CONTENT
print -
print -
print - "--${BOUNDARY}"
print - 'Content-Type: TEXT/PLAIN; charset=US-ASCII; name='${CONTENT}
print - 'Content-Disposition: attachment; filename='${CONTENT}
print -
cat ${CONTENT}
print -
print - "--${BOUNDARY}--"
} | /usr/sbin/sendmail ${MAILTO}
In order to get the attachment name without the directory included (set by variable CONTENT), cd to your 'html' directory then send the attachment without specifying the fullpath to the filename.
hai everyone
I want to send mail with attachments automatically
for every 15 minutes getting different E-mail IDs from a file
if any script is available , Please send to me ..
This will be very useful for my project....
Thanks for your time.....
Felix
... (3 Replies)
Hello I am new user on solaris...
I need to configure my solaris to be able to send mails...
I know mailx command
mailx -s hello address@address.com
but I get an error...
you have mail in /var/mail/root
# hello... User unknown
/dead.letter... Saved message in /dead.letter
what... (10 Replies)
Hi !!
I'm trying to send myself a mail from my Solaris server, i had tryed with this commands:
mail -s "test" irasela@yahoo.com < /monitoring/space/bitacora.txt
mailx -s "test" irasela@yahoo.com < /monitoring/space/bitacora.txt
sendmail -F "test" address "irasela.yahoo.com" -t... (1 Reply)
hi experts,
I m new to the sun solaris.
on our OS (sun solaris 5.8) i m trying to send mail but i not getting any mail, i have tried doing following .
$mailx -s "Test" sivakumars@kesd.com
But no response there no error also...
pls let me know:
1) How can test sending mail through... (3 Replies)
We don't have uuencode installed in our machines..... Please tell me how to send mail with multiple attachments ??? URGENT !!!!!
Please tell me using command line (or) scripts..........
please......
Thanks in Advance.... (1 Reply)
I am trying to send a mail alongwith attachments in hpux server. Its not throwing any error but it seems the command is still running,neither its sending the mail. The commands i am using is-
uuencode 00PZ00000012OHJMA2.csv | mailx -s "Hello" abc@hp.com
uuencode Shell_Script_Sample.ksh |... (1 Reply)
I have Solaris-10 and some job is writing a log. My client needs this log file every two hour in his mail.
Usually I send manual mail through mailx command, as sendmail is configured with relay server, but I am not sure, how to attach file in a mail and set it in cronjob.
Please give me some... (3 Replies)
Hi,
i try to send two (multiple) files by the mail-console-command
mail -s TEST -a f1.pdf f2.pdf n.ame@ms123.de
but it doesn't work. can someone give me a hint?
Thanks in advance,
IMPe (2 Replies)
Discussion started by: IMPe
2 Replies
LEARN ABOUT DEBIAN
courriel::header::contenttype
Courriel::Header::ContentType(3pm) User Contributed Perl Documentation Courriel::Header::ContentType(3pm)NAME
Courriel::Header::ContentType - The content type for an email part
VERSION
version 0.29
SYNOPSIS
my $ct = $part->content_type();
print $ct->mime_type();
print $ct->charset();
my %attr = $ct->attributes();
while ( my ( $k, $v ) = each %attr ) {
print "$k => $v
";
}
DESCRIPTION
This class represents the contents of a "Content-Type" header attached to an email part. Such headers always include a mime type, and may
also include additional information such as a charset or other attributes.
Here are some typical headers:
Content-Type: text/plain; charset=utf-8
Content-Type: multipart/alternative; boundary=abcdefghijk
Content-Type: image/jpeg; name="Filename.jpg"
API
This class supports the following methods:
Courriel::Header::ContentType->new_from_value( ... )
This takes two parameters, "name" and "value". The "name" is optional, and defaults to "Content-Type".
The "value" is parsed and split up into the mime type and attributes.
Courriel::Header::ContentType->new( ... )
This method creates a new object. It accepts the following parameters:
o name
This defaults to 'Content-Type'.
o value
This is the full header value.
o mime_type
A string like "text/plain" or "multipart/alternative". This is required.
o attributes
A hash reference of attributes from the header, such as a boundary, charset, etc. The keys are attribute names and the values can
either be strings or Courriel::HeaderAttribute objects. Values which are strings will be inflated into objects by the constructor.
This is optional, and can be an empty hash reference or omitted entirely.
$ct->name()
The header name, usually "Content-Type".
$ct->value()
The raw header value.
$ct->mime_type()
Returns the mime type value passed to the constructor. However, this value will be in all lower-case, regardless of the original casing
passed to the constructor.
$ct->charset()
Returns the charset for the content type, which will be the value found in the "attributes", if one exists.
$ct->attributes()
Returns a hash (not a reference) of the attributes passed to the constructor.
Attributes are Courriel::HeaderAttribute objects.
The keys of the hash are all lower case, though the original casing is preserved in the "name()" returned by the Courriel::HeaderAttribute
object.
$ct->is_binary()
Returns true unless the attachment looks like text data. Currently, this means that is has a charset defined and the charset is not
"binary".
$ct->attribute($key)
Given a key, returns the named Courriel::HeaderAttribute object. Obviously, this value can be "undef" if the attribute doesn't exist. Name
lookup is case-insensitive.
$ct->attribute_value($key)
Given a key, returns the named attribute's value as a string. Obviously, this value can be "undef" if the attribute doesn't exist. Name
lookup is case-insensitive.
The attribute is a Courriel::HeaderAttribute object.
$ct->as_header_value()
Returns the object as a string suitable for a header value (but not folded). Note that this uses the original casing of the mime type as
passed to the constructor.
EXTENDS
This class extends Courriel::Header.
ROLES
This class does the Courriel::Role::HeaderWithAttributes role.
AUTHOR
Dave Rolsky <autarch@urth.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2012 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
perl v5.14.2 2012-03-07 Courriel::Header::ContentType(3pm)