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

The AMI_MailQueue.php procedural file



Classes:

AMI_MailQueue
Class AMI_MailQueue.


Page Details:

Class AMI_MailQueue.

Allows to add e-mails into the queue and send in background.
  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');
  •  
  •  // Create array of recipients
  •  $aRecipients array(
  •      'user1@domain.name' => array('greeting' => 'Mr.''username' => 'Name1'),
  •      'user2@domain.name' => array('greeting' => 'Ms.''username' => 'Name2')
  •  );
  •  
  •  // The fields in double pluses (++greeting++, ++username++) will be replaced with a user data from $aRecipients array
  •  $oMail->body 'Hello, ++greeting++ ++username++';
  •  
  •  // Create AMI_MailQueue object
  •  $oMailQueue new AMI_MailQueue();
  •  
  •  // Add AMI_Mail object into the queue
  •  $oMailQueue->addMail($oMail$aRecipients);
  •  
  •  // Add background process for sending e-mails in queue
  •  $oMailQueue->addBackgroundProcess();
  •  
  •  $oResponse->write('The e-mail was added into the queue for sending in background.');
  •  $oResponse->send();



Tags:

since:  6.0.6