forked from jmhobbs/Swiftmailer-Transport--AWS-SES
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
25 lines (20 loc) · 975 Bytes
/
example.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
<?php
require_once 'lib/swift_required.php';
require_once 'classes/Swift/Transport/AWSTransport.php';
require_once 'classes/Swift/AWSTransport.php';
require_once 'classes/Swift/AWSInputByteStream.php';
define( 'AWSAccessKeyId', 'YOUR_ACCESS_KEY' );
define( 'AWSSecretKey', 'YOUR_SECRET_KEY' );
//Create the Transport
$transport = Swift_AWSTransport::newInstance( AWSAccessKeyId, AWSSecretKey );
$transport->setDebug( true ); // Print's the response from AWS for debugging.
//Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance( $transport );
//Create the message
$message = Swift_Message::newInstance()
->setSubject( 'What up?' )
->setFrom( array( '[email protected]' ) )
->setTo( array( '[email protected]' ) )
->setBody( "<p>Dude, I'm <b>totally</b> sending you email via AWS.</p>", 'text/html' )
->addPart( "Dude, I'm _totally_ sending you email via AWS.", 'text/plain' );
echo "Sent: " . $mailer->send( $message ) . "\n";