Yii 1.1: pear-mail

One simple mail extension for Yii framework
2 followers

It uses PEAR Mail (not bundled) and for now only includes Mailer component that allows to send plain text and MIME mails. In near future this component could permit Cc, Bcc and Reply-to settings, file attachments and so on. Put messages on a queue for later delivery is also planned.

Resources

Installation

  • Install PEAR Mail and PEAR Mail_Mime.

  • Unpack mail extension under your extensions directory.

  • Configure Mailer component (see PHPDoc):

'mailer'=>array(
        'class'=>'ext.mail.Mailer',
        'backend'=>'...',
        'backendParams'=>array(
            ...
        ),
        'mimeParams'=>array(
            ...
        ),
    ),

Usage

  • Send a plain text mail:
Yii::app()->mailer->send(
    'from@example.com',
    array(
        'to1@example.com',
        'to2@example.com',
    ),
    'Subject',
    'This is the body'
);
  • Send a MIME mail:
Yii::app()->mailer->sendMIME(
    'from@example.com',
    array(
        'to1@example.com',
        'to2@example.com',
    ),
    'Subject',
    'This is the plain text body'
    '<html><body>This is the HTML body</body></html>'
);

Be the first person to leave a comment

Please to leave your comment.

Create extension