NAME

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

SYNOPSIS

 <%Mailer
   to="foo@somehost.com"
   from="bar@otherhost.com"
   subject="Your order '<%ORDER_ID/f%>' has been shipped"
   text.path="/bits/shipped-mail-text"
   html.path="/bits/shipped-mail-html"
   ORDER_ID="<%ORDER_ID/f%>"
 %>

DESCRIPTION

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
 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;
 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' and 'cc' may be comma-separated addresses lists.

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 `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"
   ...
 %>

 mailer => {
    from => {
        customer_support => 'support@foo.com',
        technical_support => 'tech@foo.com',
    },
    ...
 }

In that case actual from address will be `support@foo.com'. 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.

METHODS

No publicly available methods except overriden display().

EXPORTS

Nothing.

AUTHOR

Copyright (c) 2000-2001 XAO, Inc.

SEE ALSO

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