Example #1
0
 function test_marshal3()
 {
     $message = new SimpleMessage\RichMessage();
     $message->setFrom("*****@*****.**")->setTo(["*****@*****.**"])->setReplyTo(["*****@*****.**"])->setCc(["*****@*****.**"])->setBcc(["*****@*****.**"])->setReturnPath("*****@*****.**")->setSubject("this should be rich text w/ all headers")->setMessage("this is some <strong>html</strong> text.");
     $expected = file_get_contents($this->getSample("sample_RichTextAllHeaders.txt"));
     $expected = str_replace("\n", "\r\n", $expected);
     $cleanups = ["!boundary=\"\\w+\"!i" => "boundary=\"SHA1-HASH\"", "!--\\w+!i" => "--SHA1-HASH"];
     $marshaled = preg_replace(array_keys($cleanups), array_values($cleanups), $message->marshal());
     // drop($expected, $marshaled);
     $this->assertEquals($expected, $marshaled, "random/unique sha1s are difficult to test against.");
 }
Example #2
0
<?php

require "vendor/autoload.php";
/**
 * RichText Raw Message
 */
$message = new SimpleMessage\RichMessage();
$message->setHeaders(["from" => "*****@*****.**", "to" => "*****@*****.**", "subject" => "this should be rich text w/ an attachment"]);
$message->setMessage("this is some <strong>html</strong> text.");
$message->attachFile("./examples/attachment.txt");
print_r($message->marshal());
/**
 * AWS SES Message
 */
$config = array("access_key" => "", "secret_key" => "", "region" => "");
//overwrite our examples
if (file_exists("conf/config.ini")) {
    $config = parse_ini_file("conf/config.ini");
}
use Aws\Common\Aws;
// Instantiate an S3 client
$aws = Aws::factory(array("key" => $config["access_key"], "secret" => $config["secret_key"], "region" => $config["region"]));
$ses = $aws->get('ses');
$message = new SimpleMessage\SESMessage();
// this is NOT a valid, verified email addess
$message->setHeaders(["from" => "*****@*****.**", "to" => "*****@*****.**", "subject" => "this should be rich text w/ an attachment"]);
$message->setMessage("this is some <strong>html</strong> text.");
$response = $ses->sendEmail($message->marshal());
print_r($response);