ePages 6.17.12 - DE_EPAGES/MailType/API/Object/SmtpConnection.pm

Package DE_EPAGES::MailType::API::Object::SmtpConnection

object interface for an SMTP Connection.

Base
DE_EPAGES::Mail::API::SMTP
Example
my $Smtp = DE_EPAGES::MailType::API::Object::SmtpConnection->new;
$Smtp->connection( sub {
    $Smtp->send( "This is a test", {
        'FROM'      => 'Sender <mailer@epages.de>',
        'TO'        => ['Recipient <rcpt@epages.de>'],
        'SUBJECT'   => 'Hallo',
    } );
});

Functions

close
new
open
send

close

obsolete. Use connection() instead.

Syntax
$Connection->close();

new

Creates a new SmtpConnection object using the SMTP server that is configured by the attributes SMTPServer, SMTPPort, SMTPLogin and SMTPPassword of the System object unless these parameters are passed to the sub-routine.

Syntax
$Connection = DE_EPAGES::MailType::API::Object::SmtpConnection->new();
$Connection = DE_EPAGES::MailType::API::Object::SmtpConnection->new( $hParameters );
Example
my $Connection = DE_EPAGES::MailType::API::Object::SmtpConnection->new({
    'SMTPServer'   => 'mailgate.epages.de',
    'SMTPPort'     => 25,
    'SMTPLogin'    => 'mmustermann',
    'SMTPPassword' => '123456',
});
Input
$hParameters (reference to hash)
custom SMTP attributes (optional), with following keys:
  • SMTPServer | SMTP server name | string
  • SMTPPort | SMTP port | integer
  • SMTPLogin | (optional) SMTP login | string
  • SMTPPassword | (optional) SMTP password | string
Return
$Connection (object)
SMTP connection object

open

obsolete. Use connection() instead.

Syntax
$Connection->open();

send

Send the e-mail using the SMPT connection

Syntax
$Connection->send( $MailBody, $hParams );
Example
$Connection->send( $Mail->createMail(), $Mail->getHeader());
Input
$MailBody (string)
MIME message body
$hParams (ref.hash.string)
E-Mail headers and envelope parameters, see
DE_EPAGES::Mail::API::SMTP::sendDataToSMTP