Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

email::send::smtp(3pm) [debian man page]

Email::Send::SMTP(3pm)					User Contributed Perl Documentation				    Email::Send::SMTP(3pm)

NAME
Email::Send::SMTP - Send Messages using SMTP SYNOPSIS
use Email::Send; my $mailer = Email::Send->new({mailer => 'SMTP'}); $mailer->mailer_args([Host => 'smtp.example.com:465', ssl => 1]) if $USE_SSL; $mailer->send($message); DESCRIPTION
This mailer for "Email::Send" uses "Net::SMTP" to send a message with an SMTP server. The first invocation of "send" requires an SMTP server arguments. Subsequent calls will remember the the first setting until it is reset. Any arguments passed to "send" will be passed to "Net::SMTP->new()", with some exceptions. "username" and "password", if passed, are used to invoke "Net::SMTP->auth()" for SASL authentication support. "ssl", if set to true, turns on SSL support by using "Net::SMTP::SSL". SMTP can fail for a number of reasons. All return values from this package are true or false. If false, sending has failed. If true, send succeeded. The return values are "Return::Value" objects, however, and contain more information on just what went wrong. Here is an example of dealing with failure. my $return = send SMTP => $message, 'localhost'; die "$return" if ! $return; The stringified version of the return value will have the text of the error. In a conditional, a failure will evaluate to false. Here's an example of dealing with success. It is the case that some email addresses may not succeed but others will. In this case, the return value's "bad" property is set to a list of bad addresses. my $return = send SMTP => $message, 'localhost'; if ( $return ) { my @bad = @{ $return->prop('bad') }; warn "Failed to send to: " . join ', ', @bad if @bad; } For more information on these return values, see Return::Value. ENVELOPE GENERATION The envelope sender and recipients are, by default, generated by looking at the From, To, Cc, and Bcc headers. This behavior can be modified by replacing the "get_env_sender" and "get_env_recipients" methods, both of which receive the Email::Simple object and their only parameter, and return email addresses. SEE ALSO
Email::Send, Net::SMTP, Net::SMTP::SSL, Email::Address, Return::Value, perl. AUTHOR
Current maintainer: Ricardo SIGNES, <rjbs@cpan.org>. Original author: Casey West, <casey@geeknest.com>. COPYRIGHT
Copyright (c) 2004 Casey West. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.4 2009-07-12 Email::Send::SMTP(3pm)

Check Out this Related Man Page

Log::Handler::Output::Email(3pm)			User Contributed Perl Documentation			  Log::Handler::Output::Email(3pm)

NAME
Log::Handler::Output::Email - Log messages as email (via Net::SMTP). SYNOPSIS
use Log::Handler::Output::Email; my $email = Log::Handler::Output::Email->new( host => "mx.bar.example", hello => "EHLO my.domain.example", timeout => 120, debug => 0, from => 'bar@foo.example', to => 'foo@bar.example', subject => "your subject", buffer => 0 ); $email->log(message => $message); DESCRIPTION
With this output module it's possible to log messages via email and it used Net::SMTP to do it. The date for the email is generated with "Email::Date::format_date". Net::SMTP is from Graham Barr and it does it's job very well. METHODS
new() Call "new()" to create a new Log::Handler::Output::Email object. The following opts are possible: host With this option you has to define the SMTP host to connect to. host => "mx.host.com" # or host => [ "mx.host.example", "mx.host-backup.example" ] hello Identify yourself with a HELO. The default is set to "EHLO BELO". timeout With this option you can set the maximum time in seconds to wait for a response from the SMTP server. The default is set to 120 seconds. from The sender address (MAIL FROM). to The receipient address (RCPT TO). Additional options are cc and bcc. subject The subject of the mail. The default subject is "Log message from $progname". buffer This opts exists only for security. The thing is that it would be very bad if something wents wrong in your program and hundreds of mails would be send. For this reason you can set a buffer to take care. With the buffer you can set the maximum size of the buffer in lines. If you set buffer => 10 then 10 messages would be buffered. Set "buffer" to 0 if you want to disable the buffer. The default buffer size is set to 20. debug With this option it's possible to enable debugging. The information can be intercepted with $SIG{__WARN__}. log() Call "log()" if you want to log a message as email. If you set a buffer size then the message will be pushed into the buffer first. Example: $email->log(message => "this message will be mailed"); If you pass the level then its placed into the subject: $email->log(message => "foo", level => "INFO"); $email->log(message => "bar", level => "ERROR"); $email->log(message => "baz", level => "DEBUG"); The lowest level is used: Subject: ERROR: ... You can pass the level with "Log::Handler" by setting message_pattern => '%L' flush() Call "flush()" if you want to flush the buffered lines. sendmail() Call "sendmail()" if you want to send an email. The difference to "log()" is that the message won't be buffered. validate() Validate a configuration. reload() Reload with a new configuration. errstr() This function returns the last error message. DESTROY
"DESTROY" is defined and called "flush()". PREREQUISITES
Carp Email::Date Net::SMTP Params::Validate EXPORTS
No exports. REPORT BUGS
Please report all bugs to <jschulz.cpan(at)bloonix.de>. If you send me a mail then add Log::Handler into the subject. AUTHOR
Jonny Schulz <jschulz.cpan(at)bloonix.de>. COPYRIGHT
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-11-21 Log::Handler::Output::Email(3pm)
Man Page