kohana email
1.0.0
使用 SwiftMailer 或 PHPMailer 的 Kohana 3.3 和 Koseven 相容電子郵件模組。
composer install
APPPATH/bootstrap.php
模組清單中: Kohana:: modules ( array (
...
' email ' => MODPATH . ' email ' ,
...
));
composer require svenbw/kohana-email:dev-master
APPPATH/bootstrap.php
中啟用供應商自動載入: require DOCROOT . ' /vendor/autoload.php ' ;
Kohana:: modules ( array (
...
' email ' => DOCROOT . ' /vendor/svenbw/kohana-email ' ,
...
));
向收件人發送訊息
$ mailer = Email:: connect ();
$ mailer -> send (
array ( ' [email protected] ' , ' To recipient ' ),
array ( ' [email protected] ' , ' The sender ' ),
' Test-email ' ,
' <i>Test email</i> ' ,
TRUE );
可以透過連結呼叫建立訊息。
$ mailer = Email:: factory ();
$ mailer
-> to ( ' [email protected] ' , ' To recipient ' )
-> from ( ' [email protected] ' , ' The sender ' )
-> subject ( ' Test-email ' )
-> html ( ' <i>Test email body</i> ' )
-> send ();