Skip to content

Email module for Kohana 3.0 framework - port of 2.3.x email helper

Notifications You must be signed in to change notification settings

atma/kohana-email

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Email Module For Kohana 3.2

This is an Email abstraction module for Swiftmailer.

It has been updated to work with SwiftMailer 4 and includes the libs from the 4.1.3 distribution.

Methods defined:

Email::connect($config = NULL)

Creates SwiftMailer object. $config is an array of configuration values and defaults to using the config file 'email.php'.

Email::send($to, $from, $subject, $message, $html = false)

$to can be any of the following:

$from can be either a string email or array of email and name as above

More complex email (multipart, attachments, batch mailing etc.) must be done using the native Swift_Mailer classes. The Swift Mailer autoloader is included by connect() so you can use and class in the Swift library without worrying about including files.

The Swift_Mailer object setup by connect is returned by it so if you need to access it manually use:

    $mailer = Email::connect();

    // Create complex Swift_Message object stored in $message

    $mailer->send($message);

Email::attach($file = null, $data = null, $contentType = null)

Modified for personal needs

Attach files, can be called multiple times. Call this before Email::send, after sending attachments are clearing. When used dynamic attachment $data $file uses for a file name, otherwise $file is an absolute file path.

Dynamic

    $file = file_get_contents('/var/log/some.log');

    Email::attach('current.log', $file);

Existing files

    Email::attach('/var/log/some.log');

About

Email module for Kohana 3.0 framework - port of 2.3.x email helper

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%