modulargaming / email
Kohana的电子邮件模块
v1.0.0
2013-07-25 16:54 UTC
Requires
- php: >=5.3.2
- composer/installers: *
- swiftmailer/swiftmailer: 5.0.*
This package is not auto-updated.
Last update: 2024-09-23 15:00:00 UTC
README
基于工厂的电子邮件类。这个类是Swiftmailer的简单封装。Swiftmailer。
使用方法
使用Email::factory($subject, $message)方法创建新的消息。添加收件人,添加发件人,发送消息
$email = Email::factory('Hello, World', 'This is my body, it is nice.')
->to('person@example.com')
->from('you@example.com', 'My Name')
->send()
;
你还可以向你的消息添加HTML内容
$email->message('<p>This is <em>my</em> body, it is <strong>nice</strong>.</p>', 'text/html');
可以使用to()、cc()和bcc()方法添加额外的收件人。
可以使用from()和reply_to()方法添加额外的发件人。如果指定了多个发件人地址,您需要使用sender()方法设置实际的消息发件人。使用return_path()方法设置退回收件人。
要直接访问和修改Swiftmailer消息,请使用raw_message()方法。
配置
配置存储在config/email.php中。选项取决于所使用的传输方法。请参阅Swiftmailer文档以了解每个传输方法可用的选项。