/** * メール送信処理 * * @return void **/ public function send() { try { $this->_validateParameters(); $this->client->sendEmail(array('Source' => '*****@*****.**', 'Destination' => array('ToAddresses' => $this->to), 'Message' => array('Subject' => array('Data' => $this->title, 'Charset' => 'ISO-2022-JP'), 'Body' => array('Text' => array('Data' => $this->body, 'Charset' => 'ISO-2022-JP'))))); } catch (\Exception $e) { throw $e; } }
/** * {@inheritDoc} */ protected function send($content, array $records) { try { $this->ses->sendEmail(['Source' => $this->from, 'Destination' => ['ToAddresses' => $this->to], 'Message' => ['Subject' => ['Data' => $this->subject, 'Charset' => 'UTF-8'], 'Body' => ['Text' => ['Data' => $content, 'Charset' => 'UTF-8']]]]); } catch (SesException $e) { if ($this->logger) { $this->logger->error("Failed to send message via AmazonSES", ['exception' => $e]); } } }
function sesMail($to, $subject, $message) { if (empty($to)) { $to = "*****@*****.**"; } $SesClient = new Aws\Ses\SesClient(['version' => 'latest', 'region' => getenv("REGION")]); $result = $SesClient->sendEmail(['Destination' => ['ToAddresses' => [$to, getenv("M_EMAIL")]], 'Message' => ['Body' => ['Text' => ['Charset' => 'UTF-8', 'Data' => $message]], 'Subject' => ['Charset' => 'UTF-8', 'Data' => $subject]], 'ReturnPath' => getenv("M_EMAIL"), 'Source' => getenv("M_EMAIL")]); return $result['MessageId']; }
function Send_Mail($from, $fromH = NULL, $to = [], $cc = [], $bcc = [], $subject, $bodyH, $bodyT) { // Initialization of initializing the initial variables, initially. global $credentials; //Considering the scope of things. Get it? Scope? $fromAdrs = $from; $sourceAdrs = isset($fromH) ? $fromH . '<' . $fromAdrs . '>' : $fromAdrs; $toAdrs = $to; $ccAdrs = $cc; $bccAdrs = $bcc; $Subject = ['Charset' => 'UTF-8', 'Data' => $subject]; $body = ['Html' => ['Charset' => 'UTF-8', 'Data' => $bodyH], 'Text' => ['Charset' => 'UTF-8', 'Data' => $bodyT]]; //Create AWS connection and SesClient $SesClient = new Aws\Ses\SesClient(['version' => 'latest', 'region' => 'us-east-1', 'credentials' => $credentials]); $result = $SesClient->sendEmail(['Destination' => ['BccAddresses' => $bccAdrs, 'CcAddresses' => $ccAdrs, 'ToAddresses' => $toAdrs], 'Message' => ['Body' => $body, 'Subject' => $Subject], 'ReplyToAddresses' => [$fromAdrs], 'ReturnPath' => $fromAdrs, 'Source' => $sourceAdrs]); // echo "Result: $result\r\n"; //DEBUG return $result['MessageId']; }
public function sendMail($title, $from, $to, $template, $data) { if (\Config::get('app.offline_mode')) { return true; } if (\App::environment() != 'production') { $title = '[' . \App::environment() . '] ' . $title; $to = ['address' => \Config::get('mail.tester'), 'name' => \App::environment() . ' Original: ' . $to['address']]; } $client = new SesClient(['credentials' => ['key' => \Config::get('aws.key'), 'secret' => \Config::get('aws.secret')], 'region' => \Config::get('aws.ses_region'), 'version' => 'latest']); try { $body = \View::make($template, $data)->render(); $sesData = ['Source' => mb_encode_mimeheader($from['name']) . ' <' . $from['address'] . '>', 'Destination' => ['ToAddresses' => [$to['address']]], 'Message' => ['Subject' => ['Data' => $title, "Charset" => "UTF-8"], 'Body' => ['Html' => ["Data" => $body, "Charset" => "UTF-8"]]]]; $client->sendEmail($sesData); } catch (\Exception $e) { echo $e->getMessage(), "\n"; } return true; }