function amazonSesEmail($to, $subject, $message) { $amazonSes = new AmazonSES(array('key' => 'AKIAIMT5T3NIZUY2PKYQ', 'secret' => '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')); //$amazonSes->verify_email_address('*****@*****.**'); $response = $amazonSes->send_email('*****@*****.**', array('ToAddresses' => array($to)), array('Subject.Data' => $subject, 'Body.Text.Data' => $message)); if (!$response->isOK()) { echo "BAD"; } else { echo "GOOD"; } }
protected static function sendUsingAmazonSES() { ProjectConfiguration::registerAws(); $email = new AmazonSES(); $message = array('Subject.Data' => self::$_subject, 'Body.Text.Data' => self::$_message); $opt = array('ReplyToAddresses' => self::$_from); if (self::$_html_message) { $message['Body.Html.Data'] = self::$_html_message; } $response = $email->send_email(self::$_from, array('ToAddresses' => self::$_to), $message, $opt); return $response->isOK(); }
function send_mail($to, $subject, $text, $from = MAILER_ADDRESS, $reply_to = ADMIN_ADDRESS) { if (USE_NATIVE_MAIL) { if (is_array($to)) { $to = implode(', ', $to); } return mail($to, $subject, $text, "From:{$from}\nReply-to:{$reply_to}"); } else { $message = array('Subject' => array('Data' => $subject), 'Body' => array('Text' => array('Data' => $text))); $opt = array('ReplyToAddresses' => $reply_to); if (!is_array($to)) { $to = array($to); } $ses = new AmazonSES(); $ret = $ses->send_email($from, array('ToAddresses' => $to), $message, $opt); return $ret->isOK(); } }
function send(Email $email) { $email = new \AmazonSES(); $dest = array(); $opt = array(); $msg = array(); if ($email->getRecipient()) { $opt['ToAddresses'] = explode(';', $email->getRecipient()); } if ($email->getCc()) { $dest['CcAddresses'] = explode(';', $email->getCc()); } if ($email->getBcc()) { $dest['BccAddresses'] = explode(';', $email->getBcc()); } if ($email->getReplyTo()) { $opt['ReplyToAddresses'] = explode(';', $email->getReplyTo()); } $msg['Subject.Data'] = $email->getSubject(); $msg['Body.Text.Data'] = $email->getBody(); return $email->send_email($email->getSender(), $dest, $msg, $opt); }
function _aws_ses() { require_once APP . 'plugins/lark_utils/vendors/awssdk/sdk.class.php'; $ses = new AmazonSES(); $destination = array('ToAddresses' => explode(',', $this->to), 'CcAddresses' => $this->cc, 'BccAddresses' => $this->bcc); $message = array('Subject' => array('Data' => $this->subject), 'Body' => array()); if ($this->textMessage != NULL) { $message['Body']['Text'] = array('Data' => $this->textMessage); } if ($this->htmlMessage != NULL) { $message['Body']['Html'] = array('Data' => $this->htmlMessage); } $opt = array(); if (isset($this->replyTo)) { $opt['ReplyToAddresses'] = $this->replyTo; } $response = $ses->send_email($this->from, $destination, $message, $opt); $ok = $response->isOK(); if (!$ok) { $this->log('Error sending email from AWS SES: ' . json_encode($response->body) . " Message was: " . $response->header['x-aws-body'], 'error'); } return $ok; }