-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend.php
More file actions
executable file
·32 lines (25 loc) · 851 Bytes
/
send.php
File metadata and controls
executable file
·32 lines (25 loc) · 851 Bytes
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
<?php
// If necessary, modify the path in the require statement below to refer to the
// location of your Composer autoload.php file.
require 'vendor/autoload.php';
define( 'AWSSESEndpoint', 'https://email.us-east-1.amazonaws.com/' );
$filename = $argv[1];
$payload = file_get_contents ( $filename );
$message = unserialize($payload);
//Create the Transport
$transport = Swift_AWSTransport::newInstance($_ENV['AWS_ACCESSKEY'], $_ENV['AWS_SECRETKEY']);
$transport->setEndpoint( AWSSESEndpoint );
//Create the Mailer using your created Transport
$mailer = new Swift_Mailer($transport);
try {
rename($filename, $filename.'.sending');
if ($mailer->send($message)) {
unlink($filename.'.sending');
} else {
rename($filename.'.sending', $filename);
}
}
catch( AWSEmptyResponseException $e ) {
echo $e . "\n";
}
?>