Koha::Email - A wrapper around Email::Stuffer
my $email = Koha::Email->new_from_string( $email_string );
Constructor for the Koha::Email class. The $email_string (mandatory) parameter will be parsed with Email::MIME.
Note: $email_string can be the produced by the as_string method from Koha::Email or Email::MIME.
my $email = Koha::Email->create( { [ text_body => $text_message, html_body => $html_message, body_params => $body_params ] from => $from, to => $to, cc => $cc, bcc => $bcc, reply_to => $reply_to, sender => $sender, subject => $subject, } );
This method creates a new Email::Stuffer object taking Koha specific configurations into account.
The encoding defaults to utf-8. It can be set as part of the body_params hashref. See Email::Stuffer and Email::MIME for more details on the available options.
Parameters: - from defaults to the value of the KohaAdminEmailAddress system preference - The SendAllEmailsTo system preference overloads the to, cc and bcc parameters - reply_to defaults to the value of the ReplytoDefault system preference - sender defaults to the value of the ReturnpathDefault system preference
Both text_body and html_body can be set later. body_params will be passed if present to the constructor.
$email->send_or_die({ transport => $transport [, $args] });
Overloaded Email::Stuffer send_or_die method, that takes care of Bcc and Return-path handling.
Bcc is removed from the message headers, and included in the recipients list to be passed to send_or_die.
Return-path, 'MAIL FROM', is set to the 'Sender' email header unless an explicit 'from' parameter is passed to send_or_die. 'Return-path' headers are actually set by the MTA, usually using the 'MAIL FROM' information set at mail server connection time.
my $is_valid = Koha::Email->is_valid($email_address);
Return true is the email address passed in parameter is valid following RFC 2822.