/
class.email.php
41 lines (35 loc) · 1001 Bytes
/
class.email.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
<?php
/**
* @package toolkit
*/
/**
* The Exception to be thrown by the Email class.
*/
class EmailException extends Exception{
}
include_once(TOOLKIT . '/class.emailgatewaymanager.php');
/**
* The Email class is a factory class to make it possible to send emails using different gateways.
*/
Abstract class Email{
private $gateway;
/**
* Returns the EmailGateway to send emails with.
* Calling this function multiple times will return unique objects.
*
* @param string $gateway
* The name of the gateway to use. Please only supply if specific
* gateway functions are being used.
* If the gateway is not found, it will throw an EmailException
* @return EmailGateway
*/
function create($gateway = null){
$email_gateway_manager = new EmailGatewayManager;
if($gateway){
return $email_gateway_manager->create($gateway);
}
else{
return $email_gateway_manager->create($email_gateway_manager->getDefaultGateway());
}
}
}