-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqa-send-mail-overrides.php
48 lines (42 loc) · 1.43 KB
/
qa-send-mail-overrides.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
<?php
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
header('Location: ../');
exit;
}
function qa_send_email($params)
{
include QA_INCLUDE_DIR.'vendor/aws.phar';
$client = Aws\Ses\SesClient::factory(array(
'version' => 'latest',
'region' => (string)qa_opt('plugin_mail_ses_region'),
'credentials' => array(
'secret' => (string)qa_opt('plugin_mail_ses_secret'),
'key' => (string)qa_opt('plugin_mail_ses_key'),
)
));
$param = array();
$param['Source'] = '=?utf-8?B?' . base64_encode($params['fromname']) . '?= <' . $params['fromemail'] . '>';
$param['Destination'] = array();
if (isset($params['toemail'])) {
$param['Destination']['ToAddresses'] = array();
$param['Destination']['ToAddresses'][] = '=?utf-8?B?' . base64_encode($params['toname']) . '?= <' . $params['toemail'] . '>';
}
$param['Message'] = array();
$param['Message']['Subject'] = array(
'Data' => $params['subject'],
'Charset' => 'utf-8',
);
$param['Message']['Body'] = array(
'Text' => array(
// Data is required
'Data' => $params['body'],
'Charset' => 'utf-8',
),
);
try {
$result = $client->sendEmail($param);
return $result;
}
catch(Exception $e) {
}
}