-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathEmailProvider.php
52 lines (48 loc) · 1.33 KB
/
EmailProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Flipside;
/**
* EmailProvider class
*
* This file describes the Singleton EmailProvider class
*
* PHP version 5 and 7
*
* @author Patrick Boyd / [email protected]
* @copyright Copyright (c) 2015, Austin Artistic Reconstruction
* @license http://www.apache.org/licenses/ Apache 2.0 License
*/
/**
* Allow other classes to be loaded as needed
*/
require_once('Autoload.php');
/**
* A singleton class allowing the caller to send Email
*
* This class will abstract out how email is sent
*/
class EmailProvider extends Provider
{
/** An array of methods that can be used to send email */
protected $methods;
/**
* Enumerate all supported EmailServices and instacetate them
*/
protected function __construct()
{
$settings = \Flipside\Settings::getInstance();
$this->methods = $settings->getClassesByPropName('email_providers');
}
/**
* Send the email
*
* @param Email\Email $email The email message to send
* @param string $methodName The class name of the email method
*
* @return boolean True if the email was sent, false otherwise
*/
public function sendEmail($email, $methodName = false)
{
$this->callFunction($methodName, 'sendEmail', array($email));
}
}
/* vim: set tabstop=4 shiftwidth=4 expandtab: */