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