Amiro.CMS API Reference
Amiro.Ru / Manual
Loading search...

The AMI_Mail class

• Introduction

Class AMI_Mail.

• Class synopsis

AMI_Mail {
/* Properties */
// E-mail body
public string $body;
// E-mail from address
public string $fromAddress;
// E-mail subject
public string $subject;
/* Methods */
// Set logging options.
public static setLogging ( [ bool $active = TRUE ], [ string $fileName = 'mailsender.log' ], [ bool $logBody = FALSE ] ) returns void;
// Constructor.
public __construct ( string $fromAddress, string $subject, string $body ) returns AMI_Mail;
// Send e-mail.
public send ( string $toAddress ) returns bool;
}

• Class Details

Allows to create and send e-mails.
  Example:
  •  $AMI_ENV_SETTINGS array('mode' => 'full''disable_cache' => true);
  •  require 'ami_env.php';
  •  
  •  $oResponse AMI::getSingleton('response');
  •  $oResponse->start();
  •  
  •  // Create AMI_Mail object
  •  $oMail new AMI_Mail('from@domain.name''Email subject''Email body');
  •  
  •  // Send email and output result
  •  $result $oMail->send('to@domain.name');
  •  $oResponse->write($result 'The e-mail was successfully accepted for delivery.' 'Error in sending e-mail.');
  •  $oResponse->send();
Tags:
since 6.0.6

• Class Properies

public string $body

E-mail body

public string $fromAddress

E-mail from address

public string $subject

E-mail subject

• Class Methods

// Set logging options.
public static setLogging ( [ bool $active = TRUE ], [ string $fileName = 'mailsender.log' ], [ bool $logBody = FALSE ] ) returns void;
  • bool $active
    Is logging enabled
  • string $fileName
    Log filename [optional]
  • bool $logBody
    Log body [optional, default: false]
// Constructor.
public __construct ( string $fromAddress, string $subject, string $body ) returns AMI_Mail;
  • string $fromAddress
    E-mail from address
  • string $subject
    E-mail subject
  • string $body
    E-mail body
// Send e-mail.
public send ( string $toAddress ) returns bool;
  • string $toAddress
    E-mail recipient address