1Mail::Send(3) User Contributed Perl Documentation Mail::Send(3)
2
3
4
6 Mail::Send - Simple electronic mail interface
7
9 require Mail::Send;
10
11 $msg = Mail::Send->new;
12 $msg = Mail::Send->new(Subject => 'example', To => 'timbo');
13
14 $msg->to('user@host');
15 $msg->to('user@host', 'user2@example.com');
16 $msg->subject('example subject');
17 $msg->cc('user@host');
18 $msg->bcc('someone@else');
19
20 $msg->set($header, @values);
21 $msg->add($header, @values);
22 $msg->delete($header);
23
24 # Launch mailer and set headers. The filehandle returned
25 # by open() is an instance of the Mail::Mailer class.
26 # Arguments to the open() method are passed to the Mail::Mailer
27 # constructor.
28
29 $fh = $msg->open; # some default mailer
30 $fh = $msg->open('sendmail'); # explicit
31 print $fh "Body of message";
32 $fh->close # complete the message and send it
33 or die "couldn't send whole message: $!\n";
34
36 Mail::Send creates e-mail messages without using the Mail::Header
37 knowledge, which means that all escaping and folding must be done by
38 you! Simplicity has its price.
39
40 When you have time, take a look at Mail::Transport
41
43 Constructors
44 Mail::Send->new(PAIRS)
45 A list of header fields (provided as key-value PAIRS) can be used
46 to initialize the object.
47
48 Header fields
49 $obj->add(FIELDNAME, VALUES)
50 Add values to the list of defined values for the FIELDNAME.
51
52 $obj->bcc(VALUES)
53 $obj->cc(VALUES)
54 $obj->delete(FIELDNAME)
55 $obj->set(FIELDNAME, VALUES)
56 VALUES will replace the old values for the FIELDNAME. Returned is
57 the LIST of values after modification.
58
59 $obj->subject(VALUES)
60 $obj->to(VALUES)
61
62 Sending
63 $obj->open(OPTIONS)
64 The OPTIONS are used to initiate a mailer object via
65 Mail::Mailer::new(). Then Mail::Mailer::open() is called with the
66 knowledge collected in this Mail::Send object.
67
69 This module is part of the MailTools distribution,
70 http://perl.overmeer.net/mailtools/.
71
73 The MailTools bundle was developed by Graham Barr. Later, Mark
74 Overmeer took over maintenance without commitment to further
75 development.
76
77 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
78 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
79 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
80
82 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
83 Overmeer <perl@overmeer.net>.
84
85 This program is free software; you can redistribute it and/or modify it
86 under the same terms as Perl itself. See
87 http://www.perl.com/perl/misc/Artistic.html
88
89
90
91perl v5.16.3 2012-12-21 Mail::Send(3)