-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMail.php
36 lines (30 loc) · 884 Bytes
/
Mail.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
<?php
namespace App;
use Mailgun\Mailgun;
/* Mail class */
class Mail {
/**
* METHOD, send
* @param string : $to = recipient
* @param string : $subject
* @param string : $text (core msg)
* @param string : $html HTML content of the message
* @return mixed :
*/
public static function send($to,$subject,$text,$html) {
$mailgun = Mailgun::create(Config::MAILGUN_API_KEY);//private API key
$domain = Config::MAILGUN_DOMAIN;
if (\App\Config::MAILGUN_TEST_STATUS===true) {
$to = \App\Config::MAILGUN_TEST_EMAIL;
}
//Compose and send message
$mailgun->messages()->send($domain,array(
'from'=>'bob@example.com',
'to'=>$to,
'subject'=>$subject,
'text'=>$text,
'html'=>$html
));
}
}
?>