-
Notifications
You must be signed in to change notification settings - Fork 10
Stefano Azzolini edited this page Mar 23, 2017
·
4 revisions
The Email modules will allow you to send email messages via various services providers.
You can choose the Email service via the using method. The optional second parameter is dictionary of init paramenters to pass to the selected driver.
The default driver is Native, the a service that uses the PHP mail function.
Email::using('native');Init a service with parameters :
Email::using('SMTP',[
'host' => 'smtp.starkindustries.com',
'port' => 25,
'username' => 'tony',
'password' => 'pepperpotts',
]);You can send an email with the chosen service via the Email::send method.
An associative array must be passed with the email definition.
Email::send([
'to' => 'info@shield.com',
'from' => 'Tony <tony@starkindustries.com>',
'subject' => 'About your proposal...',
'message' => '<b>NOT</b> interested.',
]);You can add attachments passing file URLs to the attachments key :
Email::send([
'to' => 'Bruce <dr.banner@greenrelax.com>',
'from' => 'Tony <tony@starkindustries.com>',
'subject' => 'Jarvis Code Matrix',
'message' => "Hey Pea, I'm sending you the AI code matrix of Jarvis.",
'attachments' => '/usr/home/tony/jarvis.matrix.dat',
]);The attachments key also accept an array of multiple file descriptors :
- Local file paths
- URLs
- Raw content
'attachments' => [
'/usr/home/tony/jarvis.matrix.dat',
'http://vignette3.wikia.nocookie.net/marvelcentral/images/6/61/Iron_man_tony_stark_hi_res.jpg',
[
'name' => 'report.csv',
'content' => "A,B,C,D\n1,2,3,4\n5,6,7,8",
],
],The to and from properties accepts one or an array of email addresses in these formats :
user@host.com<user@host.com>Name Surname <user@host.com>
Core is maintained by using the Semantic Versioning Specification (SemVer).
Copyright 2014-2016 Caffeina srl under the MIT license.
http://caffeina.com