Multipart.pm
$smtp = Net::SMTP::Multipart->new("mailrelay.someco.com"); $smtp->Header(To => "someone\@someco.com", Subj => "Multipart Mail Demo", From => "me\@someco.com"); $smtp->Text("This is the first text part of the message"); $smtp->FileAttach("c:/tmp/myfile.xls"); $smtp->End();
This module uses the Net::SMTP and Mime::Base64 modules to compose and send multipart mail messages. It uses the Net::SMTP methods, but simplifies formatting of multipart messages using its internal methods Header, Text, FileAttach and End.
The new method invokes a new instance of the Net::SMTP::Multipart class, using the same arguments as the parent method.
The Header method creates the header of the multipart message. It should be called with the following arguments
an array of mail addresses to which the mail is to be sent
the mail address from which the mail is sent
the subject title of the mail
This method generates a text part to the message. The argument provided is treated as text and populates the text part of the message.
This method includes a file (identified in the argument when this is called) within an encoded part of the message.
This method generates an epilogue part to the message. The argument provided is treated as text and populates the epilogue (which most mail agents do not display). The mail message is then sent and the class instance destroyed.
Carp
MIME::Base64
Net::SMTP
strict
vars
Dave Roberts
You can send bug reports and suggestions for improvements on this module to me at Dave@herouville.biz. However, I can't promise to offer any other support for this script.
This script is Copyright © 2002,2006 Dave Roberts. All rights reserved.
This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. The copyright holder of this script can not be held liable for any general, special, incidental or consequential damages arising out of the use of the script.
$Log: Multipart.pm $ Revision 1.6 2006/12/10 20:01:37 Dave.Roberts This revision (from a patch supplied by cedric_pellerin@yahoo.fr provides a file anme for the attachment that is required by some mail readers
Revision 1.5 2002/11/11 12:12:18 Dave.Roberts corrected bug in documentation synopsis - changed Net::SMTP::MultiPart to Net::SMTP::Multipart
Revision 1.4 2002/04/05 11:36:33 Dave.Roberts change to version number generation code
Revision 1.3 2002/03/27 09:16:29 Dave.Roberts initial pod added
Revision 1.2 2002/03/26 12:03:23 Dave.Roberts added basic pod structure
1 POD Error
The following errors were encountered while parsing the POD:
Non-ASCII character seen before =encoding in '©'. Assuming CP1252
To install Net::SMTP::Multipart, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::SMTP::Multipart
CPAN shell
perl -MCPAN -e shell install Net::SMTP::Multipart
For more information on module installation, please visit the detailed CPAN module installation guide.