Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F103665783
PhabricatorMailImplementationAmazonSESAdapter.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Mar 3, 20:48
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Mar 5, 20:48 (2 d)
Engine
blob
Format
Raw Data
Handle
24632547
Attached To
rPH Phabricator
PhabricatorMailImplementationAmazonSESAdapter.php
View Options
<?php
final
class
PhabricatorMailImplementationAmazonSESAdapter
extends
PhabricatorMailImplementationPHPMailerLiteAdapter
{
const
ADAPTERTYPE
=
'ses'
;
private
$message
;
private
$isHTML
;
public
function
prepareForSend
()
{
parent
::
prepareForSend
();
$this
->
mailer
->
Mailer
=
'amazon-ses'
;
$this
->
mailer
->
customMailer
=
$this
;
}
public
function
supportsMessageIDHeader
()
{
// Amazon SES will ignore any Message-ID we provide.
return
false
;
}
protected
function
validateOptions
(
array
$options
)
{
PhutilTypeSpec
::
checkMap
(
$options
,
array
(
'access-key'
=>
'string'
,
'secret-key'
=>
'string'
,
'endpoint'
=>
'string'
,
'encoding'
=>
'string'
,
));
}
public
function
newDefaultOptions
()
{
return
array
(
'access-key'
=>
null
,
'secret-key'
=>
null
,
'endpoint'
=>
null
,
'encoding'
=>
'base64'
,
);
}
public
function
newLegacyOptions
()
{
return
array
(
'access-key'
=>
PhabricatorEnv
::
getEnvConfig
(
'amazon-ses.access-key'
),
'secret-key'
=>
PhabricatorEnv
::
getEnvConfig
(
'amazon-ses.secret-key'
),
'endpoint'
=>
PhabricatorEnv
::
getEnvConfig
(
'amazon-ses.endpoint'
),
'encoding'
=>
PhabricatorEnv
::
getEnvConfig
(
'phpmailer.smtp-encoding'
),
);
}
/**
* @phutil-external-symbol class SimpleEmailService
*/
public
function
executeSend
(
$body
)
{
$key
=
$this
->
getOption
(
'access-key'
);
$secret
=
$this
->
getOption
(
'secret-key'
);
$endpoint
=
$this
->
getOption
(
'endpoint'
);
$root
=
phutil_get_library_root
(
'phabricator'
);
$root
=
dirname
(
$root
);
require_once
$root
.
'/externals/amazon-ses/ses.php'
;
$service
=
new
SimpleEmailService
(
$key
,
$secret
,
$endpoint
);
$service
->
enableUseExceptions
(
true
);
return
$service
->
sendRawEmail
(
$body
);
}
}
Event Timeline
Log In to Comment