Mail::Send3pm
Simple electronic mail interface
Usage
require Mail::Send;$msg = Mail::Send->new;$msg = Mail::Send->new(Subject => 'example', To => 'timbo');$msg->to('user@host');$msg->to('user@host', '[email protected]');$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'); # explicitprint $fh "Body of message";$fh->close # complete the message and send itor die "couldn't send whole message: $!\n";
Overview
Mail::Send creates e-mail messages without using the Mail::Header knowledge, which means that all escaping and folding must be done by you! Also: do not forget to escape leading dots. Simplicity has its price.
When you have time, take a look at Mail::Transport which is part of the MailBox suite.
Methods
Constructors
- Mail::Send->
new(PAIRS) -
A list of header fields (provided as key-value PAIRS) can be used to initialize the object, limited to the few provided as method:
"to","subject","cc", and"bcc". For other header fields, useadd().
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) -
The
@valueswill 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
%optionsare used to initiate a mailer object viaMail::Mailer::new(). ThenMail::Mailer::open()is called with the knowledge collected in this"Mail::Send"object.Be warned: this module implements raw smtp, which means that you have to escape lines which start with a dot, by adding one in front.
Releases
18 releases since Debian 1.2 (Rex); the text changed 14 times.