app-skeleton / email
基于 swiftmailer 的 Kohana 邮件模块
dev-3.3/master
2013-11-18 09:23 UTC
Requires
- php: >=5.3.3
- app-skeleton/auth: dev-3.3/master
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-09-24 07:01:50 UTC
README
基于工厂的电子邮件类。此类是 Swiftmailer 的简单包装。
使用方法
使用 Email::factory($subject, $message, $mime_type)
方法创建新消息。
添加收件人、添加发件人、发送消息
$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 文档,了解每个传输方法可用的选项。