Last active
August 6, 2021 14:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// www.fduran.com | |
// send mail with Amazon AWS SES without extra library | |
// needs Pear: apt-get install php-pear | |
<?php | |
function mailSES($to, $subject, $body, $from) | |
{ | |
include_once('Mail.php'); | |
$headers["From"] = $from; | |
$headers["To"] = $to; | |
$headers["Subject"] = $subject; | |
$params["host"] = "ssl://email-smtp.us-east-1.amazonaws.com"; | |
$params["port"] = "465"; | |
$params["auth"] = true; | |
$params["username"] = "";// NEED USERNAME | |
$params["password"] = "";// NEED PASSWORD | |
try | |
{ | |
$mail_object =& Mail::factory("smtp", $params); | |
$mail_res = $mail_object->send($to, $headers, $body); | |
} | |
catch (Exception $e) | |
{ | |
echo("Error sending mail: " . $e->getMessage() . "\n"); | |
} | |
return false; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment