Package DE_EPAGES::MailType::API::Object::MailType
object interface for MailType (aka e-mail events).
Base |
DE_EPAGES::Object::API::Object::Object |
Example |
#send order confirmation mail to customer my $MailType = $Order->getSite()->child('MailTypes')->child('CustomerOrderConfirmation'); # create and send mail my %MailParams = ( 'HTMLAllowed' => $Order->get('Customer')->get('IsHtmlEMailAllowed'), ); my $Email = $Order->get('BillingAddress')->get('EMail'); $MailParams{'TO'} = $Email if defined $Email; my %Vars = (); my $Container = $Order->get('LineItemContainer'); my %RegionalParams = ( Locale => $Container->get('LocaleID'), Language => GetCodeByLanguageID($Container->get('LanguageID')), ); $MailType->send( $Order, \%MailParams, \%RegionalParams, \%Vars ); |
Functions
className
Returns the class name, used for DAL access.
Syntax |
$ClassName = $MailType->className; |
Return |
|
content
The TLE placeholders in the mail template content are replaced by the variables given in $hVars.
Syntax |
$Content = $MailType->content( $Object, $Content, $hRegionalParams, $hVars ); |
Example |
$Content = $MailType->content( $System, undef, $hRegionalParams, $hVars ); |
Input |
|
Return |
|
dbPackage
Returns the database package, used for DAL access.
Syntax |
$DbPackage = $MailType->dbPackage; |
Return |
|
from
returns FROM address string of the mail
Syntax |
$FROM = $MailType->from; $FROM = $MailType->from( $FROM ); |
Example |
$FROM = $MailType->from; |
Input |
|
Return |
|
getMail
Creates an e-mail object for the mail type.
Syntax |
$Mail = $MailType->getMail($Object, $hParams, $hRegionalParams, $hVars); |
Input |
|
Return |
|
Hook |
|
joinMailAddress
joins the name and email to an email-address
Syntax |
$EMailAddress = $MailType->joinMailAddress($Name, $EMail); |
Example |
$EMailAddress = $MailType->joinMailAddress("Max Mustermann", "m.mustermann@epages.de"); $EMailAddress eq '"Max Mustermann" <m.mustermann@epages.de>' |
Input |
|
Return |
|
replaceTLEs
The TLE placeholders in the string are replaced by the variables given in $hVars.
Syntax |
$String = $MailType->replaceTLEs( $Object, $String, $hRegionalParams, $hVars ); |
Example |
$String = $MailType->replaceTLEs( $System, 'Hello #FirstName', $hRegionalParams, $hVars ); |
Input |
|
Return |
|
send
Sends an e-mail object using the current mail type if the MailType is active or not. The TLE placeholders in the mail templates for Content, Subject and Signature are replaced by the variables given in $hVars. Triggers the hook "MailTypeSend" before actually building the mail object and sendinf the mail. Hook functions can prevent the mail from beeing sent by setting the hook parameter "SendMail" to 0. In this case the return value will be 0.
Syntax |
$Sent = $MailType->send($Object, $hMailParams, $hRegionalParams, $hVars ); |
Example |
$MailType->send( $User, { HTMLAllowed => 1, TO => $User->get('EMail'), }, { Language => 'de', Locale => 'de_DE' }, { } ); |
Input | |
Return |
|
sendMail
Sends the e-mail using the default SMTP connection that is configured in the current database.
Syntax |
$MailType->sendMail( $Mail ); |
Input |
|
to
returns TO address string of the mail
Syntax |
$TO = $MailType->to; $TO = $MailType->to( $TO ); |
Example |
$TO = $MailType->to; |
Input |
|
Return |
|