REDROOM
PHP 8.1.33
Path:
Logout
Edit File
Size: 2.92 KB
Close
/home/jambtst2015/public_html/protected/extensions/yii-multimailer/Examples/default-db.php
Text
Base64
<?php /** * @author Pawel Bizley Brzozowski * @version 1.0 * * MultiMailer default DB implementation * This sets DB method with minimum options. */ /** * ----------------------------------------------------------------------------- * Configuration: * <Yii directory>/protected/config/main.php * ----------------------------------------------------------------------------- */ return array( // ... 'components' => array( // ... 'MultiMailer' => array( 'class' => 'ext.MultiMailer.MultiMailer', 'setFromAddress' => 'example@example.com', 'setFromName' => 'Example', 'setMethod' => 'DB', 'setDbModel' => 'Email', ), // ... ), // ... ); /** * ----------------------------------------------------------------------------- * Database table, i.e. MySQL * ----------------------------------------------------------------------------- * * CREATE TABLE IF NOT EXISTS `emails` ( * `id` INT NOT NULL AUTO_INCREMENT, * `email` VARCHAR(255) NOT NULL, * `name` VARCHAR(255) NOT NULL, * `subject` VARCHAR(255) NOT NULL, * `body` TEXT NOT NULL, * `alt` TEXT DEFAULT NULL, * PRIMARY KEY (`id`) * ) ENGINE=InnoDB; */ /** * ----------------------------------------------------------------------------- * Active Record model: * ----------------------------------------------------------------------------- */ class Email extends CActiveRecord { public function tableName() { return 'emails'; } public function rules() { return array( array('email, name, subject, body', 'required'), array('email, name, subject', 'length', 'max' => 255), array('email', 'email'), array('email, name, subject, body, alt', 'safe', 'on' => 'search'), ); } public static function model($className = __CLASS__) { return parent::model($className); } } /** * ----------------------------------------------------------------------------- * Usage: * ----------------------------------------------------------------------------- */ class ExampleController extends Controller { public function actionIndex() { $recipientEmail = 'recipient@example.com'; $recipientName = 'Example Name'; $emailSubject = 'Example email subject'; $emailBody = '<h1>Hello</h1><p>This is test.<br>MultiMailer test.</p>'; $mailer = Yii::app()->MultiMailer->to($recipientEmail, $recipientName); $mailer->subject($emailSubject); $mailer->body($emailBody); if ($mailer->send()) { $result = 'Test email has been saved in database successfully.'; } else { $result = 'Test email saving in database error!<br>' . $mailer->getMultiError(); } $this->render('index', array('result' => $result)); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
all-default-options.php
1.65 KB
lrw-r--r--
2024-11-22 17:53:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
default-db.php
2.92 KB
lrw-r--r--
2024-11-22 17:53:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
default-mail.php
1.63 KB
lrw-r--r--
2024-11-22 17:53:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
default-smtp.php
1.87 KB
lrw-r--r--
2024-11-22 17:53:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
mail-with-template.php
2.13 KB
lrw-r--r--
2024-11-22 17:53:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).