ultimix
mail_1_0_0 Class Reference

Public Member Functions

 load_settings ()
 __construct ()
 send_email ($From, $To, $Subject, $Message, $Sender=false)

Data Fields

 $AutoMarkup = false
 $Security = false
 $Tags = false
 $Timeout = 0
 $LastCallTime = 0

Detailed Description

Class sending emails.

Author
Dodonov A.A.

Definition at line 26 of file mail.php.

Constructor & Destructor Documentation

__construct ( )

Constructor.

Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 109 of file mail.php.

{
try
{
$this->LastCallTime = microtime( true ) - $this->Timeout / 1000000;
$this->AutoMarkup = get_package( 'page::auto_markup' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->Tags = get_package( 'string::tags' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Member Function Documentation

load_settings ( )

Function loads settings.

Exceptions
ExceptionAn exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 80 of file mail.php.

{
try
{
$Settings = get_package_object( 'settings::settings' , 'last' , __FILE__ );
$CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$Settings->load_settings( $CachedMultyFS->get_config( __FILE__ , 'cf_mail' ) );
$this->Timeout = $Settings->get_setting( 'timeout' , 0 );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}
send_email (   $From,
  $To,
  $Subject,
  $Message,
  $Sender = false 
)

Function sends email.

Parameters
$From- Email of the sender.
$To- Address of the recipient.
$Subject- Mail's subject.
$Message- Mail's message.
$Sender- Sender's name.
Exceptions
Exception- An exception of this type is thrown.
Author
Dodonov A.A.

Definition at line 253 of file mail.php.

{
try
{
if( microtime( true ) < $this->LastCallTime + $this->Timeout / 1000000 )
{
usleep( $this->LastCallTime + $this->Timeout / 1000000 - microtime( true ) );
}
$Subject = $this->compile_string( $Subject );
$Message = $this->compile_string( $Message );
$Headers = $this->get_headers( $From , $Sender );
if( mail( $To , $Subject , $Message , implode( '' , $Headers ) ) === false )
{
throw( new Exception( 'An error occured while sending email' ) );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

Field Documentation

$AutoMarkup = false

Cached packages.

Author
Dodonov A.A.

Definition at line 38 of file mail.php.

$LastCallTime = 0

Time of the last call of the method 'send_mail'.

Author
Dodonov A.A.

Definition at line 64 of file mail.php.

$Security = false

Definition at line 39 of file mail.php.

$Tags = false

Definition at line 40 of file mail.php.

$Timeout = 0

Function call timeout.

Author
Dodonov A.A.

Definition at line 52 of file mail.php.


The documentation for this class was generated from the following file: