Sponsored Content
Top Forums Shell Programming and Scripting Mailing multiple PNG attachments using sendmail Post 302934098 by ajayram_arya on Wednesday 4th of February 2015 02:56:29 PM
Old 02-04-2015
Code

Thank you very much gandolf989. It worked .

I installed the perl module "MIME-Lite-3.01.tar.gz" used the below code and it works great.

Code:
#!/usr/bin/perl

use MIME::Lite;

$from = 'qwerty\@erweer.com';
$to = 'abcd\@efgh.com';
$Subject = 'Hello';

# Part using which the attachment is sent to an email #
$msg = MIME::Lite->new(
        From     => $from,
        To       => $to,
        Subject  => $Subject,
        Type     => 'multipart/Mixed',
);
$msg->attach(
      Type     => 'Text', 
      Data     => "The attachment contains your file"
);
$msg->attach(
    Type     => 'Image/gif',
        Path         => "/abcd/M.gif"
);

print "Mail Sent\n";
$msg->send; # send via default

 

10 More Discussions You Might Find Interesting

1. Answers to Frequently Asked Questions

multiple attachments

how can you send multiple attachments in 1 email, usually I just use uuencode to send 1 attachment. thanks (5 Replies)
Discussion started by: edog
5 Replies

2. How do I send email?

multiple attachments

how can you send multiple attachments in 1 email, usually I just use uuencode to send 1 attachment. thanks (5 Replies)
Discussion started by: edog
5 Replies

3. UNIX for Advanced & Expert Users

mailing with attachments in mail command in HP-UX Release 11i

Hi Can some one tell me how to send a mail with body and file attached in a shell sript, in HP-UX Release 11i. i did code in AIX and it works fine but i guess here in HP-UX release.. there's some syntax change which i;m not able to make out.. TIA, Ronnie (1 Reply)
Discussion started by: rosh0623
1 Replies

4. UNIX for Dummies Questions & Answers

sendmail attachments

Dear all, I've been working with AIX for, um, 15 years now and I have read all I can about the above, but I am stuck. Everything seems to point to using sendmail on the command line to embed a uuencoded attatchment will not work. Using something like "(cat plain.txt;uuencode attach.file... (4 Replies)
Discussion started by: rbatte1
4 Replies

5. Shell Programming and Scripting

sendmail with attachments

Hi, I got the following script from Ygor on this site: #!/usr/bin/ksh export MAILTO="email_address" export CONTENT="/export/home/aisdba/email_body.html" export SUBJECT="subject of email" ( echo "Subject: $SUBJECT" echo "MIME-Version: 1.0" echo "Content-Type: text/html" echo... (9 Replies)
Discussion started by: suthera
9 Replies

6. Shell Programming and Scripting

E-mailing Multiple Attachments in AIX

Hello Everyone, I'm trying to write ascript on AIX 5.3, that will e-mail all filles within a directory. But on executing a script , it sends only 1 file from the directory alongwith some Junk data. I have searched whole forum and almost used all the suggestions, but still getting same problem.... (4 Replies)
Discussion started by: Gem_In_I
4 Replies

7. Shell Programming and Scripting

Sendmail Script: Gmail cannot find attachments

Hi. I am using a script on HP-UX to send emails that include a Pdf attachment to clients. The scipt makes use of sendmail. The scripts works for everything except gmail. When I go on gmail via my Web Browser, I can see the message with the attachment, but if I try to view or download the... (2 Replies)
Discussion started by: Wahooka
2 Replies

8. Shell Programming and Scripting

Sendmail Png Attachments

I use sendmail to send html emails, my script works perfect and sends email with plain text attachment. Now i need to attache png file to the email and this attachment part is not working. ( echo "From: $FROM" echo "To: $TO" echo "MIME-Version: 1.0" echo "Subject: $SUBJECT" echo... (4 Replies)
Discussion started by: posner
4 Replies

9. Shell Programming and Scripting

Sendmail gz Attachments

Hi All, I have a problem again with sendmail content type . I am trying to attach the gz file to the html email but couldnt figure out even after extensive google. Here is my code. ( echo "From: $FROM" echo "To: $MAILTO" echo... (3 Replies)
Discussion started by: posner
3 Replies

10. Shell Programming and Scripting

Sendmail - Attachments & Subjects

Hi All, Not been around in a while. However I have been all over tinternet (google) for days looking for a solution. Where I work has decided to use Sendmail on our Linux and Unix estate for sending emails via scripts. So I am hoping to eventually get a working solution for Sendmail and not... (3 Replies)
Discussion started by: dakelly
3 Replies
Mail::Send(3)						User Contributed Perl Documentation					     Mail::Send(3)

NAME
Mail::Send - Simple electronic mail interface SYNOPSIS
require Mail::Send; $msg = Mail::Send->new; $msg = Mail::Send->new(Subject => 'example', To => 'timbo'); $msg->to('user@host'); $msg->to('user@host', 'user2@example.com'); $msg->subject('example subject'); $msg->cc('user@host'); $msg->bcc('someone@else'); $msg->set($header, @values); $msg->add($header, @values); $msg->delete($header); # Launch mailer and set headers. The filehandle returned # by open() is an instance of the Mail::Mailer class. # Arguments to the open() method are passed to the Mail::Mailer # constructor. $fh = $msg->open; # some default mailer $fh = $msg->open('sendmail'); # explicit print $fh "Body of message"; $fh->close # complete the message and send it or die "couldn't send whole message: $! "; DESCRIPTION
Mail::Send creates e-mail messages without using the Mail::Header knowledge, which means that all escaping and folding must be done by you! Simplicity has its price. When you have time, take a look at Mail::Transport METHODS
Constructors Mail::Send->new(PAIRS) A list of header fields (provided as key-value PAIRS) can be used to initialize the object. Header fields $obj->add(FIELDNAME, VALUES) Add values to the list of defined values for the FIELDNAME. $obj->bcc(VALUES) $obj->cc(VALUES) $obj->delete(FIELDNAME) $obj->set(FIELDNAME, VALUES) VALUES will replace the old values for the FIELDNAME. Returned is the LIST of values after modification. $obj->subject(VALUES) $obj->to(VALUES) Sending $obj->open(OPTIONS) The OPTIONS are used to initiate a mailer object via Mail::Mailer::new(). Then Mail::Mailer::open() is called with the knowledge collected in this Mail::Send object. SEE ALSO
This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/. AUTHORS
The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance without commitment to further development. Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog. LICENSE
Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark Overmeer <perl@overmeer.net>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html perl v5.12.1 2010-01-26 Mail::Send(3)
All times are GMT -4. The time now is 11:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy