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
46 A list of header fields (provided as key-value PAIRS) can be used
47 to initialize the object.
48
49 Header fields
50 $obj->add(FIELDNAME, VALUES)
51
52 Add values to the list of defined values for the FIELDNAME.
53
54 $obj->bcc(VALUES)
55
56 $obj->cc(VALUES)
57
58 $obj->delete(FIELDNAME)
59
60 $obj->set(FIELDNAME, VALUES)
61
62 VALUES will replace the old values for the FIELDNAME. Returned is
63 the LIST of values after modification.
64
65 $obj->subject(VALUES)
66
67 $obj->to(VALUES)
68
69 Sending
70 $obj->open(OPTIONS)
71
72 The OPTIONS are used to initiate a mailer object via
73 Mail::Mailer::new(). Then Mail::Mailer::open() is called with the
74 knowledge collected in this Mail::Send object.
75
77 This module is part of the MailTools distribution,
78 http://perl.overmeer.net/mailtools/.
79
81 The MailTools bundle was developed by Graham Barr. Later, Mark
82 Overmeer took over maintenance without commitment to further
83 development.
84
85 Mail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by
86 Peter Orbaek <poe@cit.dk>. Mail::Mailer and Mail::Send by Tim Bunce
87 <Tim.Bunce@ig.co.uk>. For other contributors see ChangeLog.
88
90 Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2007 Mark
91 Overmeer <perl@overmeer.net>.
92
93 This program is free software; you can redistribute it and/or modify it
94 under the same terms as Perl itself. See
95 http://www.perl.com/perl/misc/Artistic.html
96
97
98
99perl v5.12.2 2010-10-01 Mail::Send(3)