XAO::DO::Web::Mailer - executes given template and sends results via e-mail


   subject="Your order '<%ORDER_ID/f%>' has been shipped"


Displays nothing, just sends message.

Arguments are:

 to          => e-mail address of the recepient; default is taken from
                userdata->email if defined.
 cc          => optional e-mail addresses of secondary recepients
 bcc         => optional e-mail addresses of blind CC recepients
 from        => optional 'from' e-mail address, default is taken from
                'from' site configuration parameter.
 subject     => message subject;
 [text.]path => text-only template path (required);
 html.path   => html template path;
 date        => optional date header, passed as is;
 pass        => pass parameters of the calling template to the mail template;
 ARG         => VALUE - passed to Page when executing templates;

If 'to', 'from' or 'subject' are not specified then get_to(), get_from() or get_subject() methods are called first. Derived class may override them. 'To', 'cc' and 'bcc' may be comma-separated addresses lists.

To send additional attachments along with the email pass the following arguments (where N can be any alphanumeric tag):

 attachment.N.type        => MIME type for attachment (image/gif, text/plain, etc)
 attachment.N.filename    => download filename for the attachment (optional)
 attachment.N.disposition => attachment disposition (optional, 'attachment' by default)
 attachment.N.path        => path to a template for building the attachment
 attachment.N.template    => inline template for building the attachment
 attachment.N.unparsed    => use the template literally, without xao-parsing
 attachment.N.pass        => pass all arguments of the calling template
 attachment.N.ARG         => VALUE - passed literally as ARG=>VALUE to the template

The configuration for Web::Mailer is kept in a hash stored in the site configuration under 'mailer' name. Normally it is not required, the default is to use sendmail for delivery. The parameters are:

 method     => either 'local' or 'smtp'
 agent      => server name for `smtp' or binary path for `local'
 from       => either a hash reference or a scalar with the default
                `from' address.
            => if set overrides the from address
            => if set overrides all to addresses and always sends to
               the given address. Useful for debugging.
            => addresses listed here are OK to go through. Matching
               is done on substrings ingoring case. This options makes
               sense only in pair with override_to.
            => optional fixed prefix for all subjects
            => optional fixed suffix for all subjects

If `from' is a hash reference then the content of `from' argument to the object is looked in keys and the value is used as actual `from' address. This can be used to set up rudimentary aliases:


 mailer => {
    from => {
        customer_support => '',
        technical_support => '',

In that case actual from address will be `'. By default if `from' in the configuration is a hash and there is no `from' parameter for the object, `default' is used as the key.


No publicly available methods except overriden display().




Copyright (c) 2005 Andrew Maltsev

Copyright (c) 2001-2004 Andrew Maltsev, XAO Inc.

<> --


Recommended reading: XAO::Web, XAO::DO::Web::Page.