/** * {@inheritdoc} */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { $this->beforeSendPerformed($message); $headers = $message->getHeaders(); $headers->addTextHeader('X-SES-Message-ID', $this->ses->sendRawEmail(['Source' => key($message->getSender() ?: $message->getFrom()), 'RawMessage' => ['Data' => $message->toString()]])->get('MessageId')); $this->sendPerformed($message); return $this->numberOfRecipients($message); }
/** * * @param \talview\sesmailer\Message $message * * @return bool */ protected function sendMessage($message) { try { return $this->client->sendRawEmail(['RawMessage' => ['Data' => $message->getSwiftMessage()]]); } catch (SesException $e) { echo $e->getMessage(); Yii::error($e->getMessage()); } return false; }
protected function sendMessage($to, $from, $subject, Mime\Message $body, $headers = false) { $message = new Mail\Message(); $message->setTo($to); $message->setFrom($from); $message->setSubject($subject); $message->setBody($body); if ($headers) { $message->getHeaders()->addHeaders($headers); } return $this->client->sendRawEmail(array('Source' => $from, 'Destinations' => array($to), 'RawMessage' => array('Data' => $this->getMessageText($message)))); }
/** * ses://accessid:aswsecret@region * * @param Envelope $envelope * @return bool */ public function send(Envelope $envelope) { $mail = $this->prepareMailer($envelope); // Call the preSend to set all PHPMailer variables and get the correct header and body; $message = $mail->getFullMessageEnvelope(); // Fix BCC header because PHPMailer does not send to us foreach ((array) $envelope->getBCC() as $bccEmail) { $message = 'Bcc: ' . $bccEmail . "\n" . $message; } //Send the message (which must be base 64 encoded): $ses = new SesClient(['credentials' => new Credentials($this->connection->getUsername(), $this->connection->getPassword()), 'region' => $this->connection->getServer(), 'version' => '2010-12-01']); $ses->sendRawEmail(['RawMessage' => ['Data' => $message]]); return true; }
protected function sendMessage($destinations, $from, $subject, Mime\Message $body, $headers = false) { $message = new Mail\Message(); $message->setFrom($this->alwaysFrom ? $this->alwaysFrom : $from); $message->setSubject($subject); $message->setBody($body); $message->setReplyTo($from); if (isset($destinations)) { $destinations = is_array($destinations) ? $destinations : explode(',', $destinations); } else { $destinations = array(); } //Set our headers. If we find CC or BCC emails add them to the Destinations array if (!isset($headers['To'])) { $headers['To'] = implode('; ', $destinations); } if (isset($headers['Cc'])) { $destinations = array_merge($destinations, explode(',', $headers['Cc'])); } if (isset($headers['Bcc'])) { $destinations = array_merge($destinations, explode(',', $headers['Bcc'])); } // if a custom 'reply-to' address has been set via headers if (isset($headers['Reply-To'])) { $message->setReplyTo($headers['Reply-To']); unset($headers['Reply-To']); } if ($headers) { $message->getHeaders()->addHeaders($headers); } //if no Destinations address is set SES will reject the email. if (!array_filter($destinations)) { throw new LogicException('No Destinations (To, Cc, Bcc) for email set.'); } try { $response = $this->client->sendRawEmail(array('Destinations' => $destinations, 'RawMessage' => array('Data' => $this->getMessageText($message)))); } catch (\Aws\Ses\Exception\SesException $ex) { return false; } /* @var $response Aws\Result */ if (isset($response['MessageId']) && strlen($response['MessageId'])) { return true; } }
/** * {@inheritdoc} */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { $this->beforeSendPerformed($message); return $this->ses->sendRawEmail(['Source' => key($message->getSender() ?: $message->getFrom()), 'RawMessage' => ['Data' => $message->toString()]]); }
/** * {@inheritdoc} */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { return $this->ses->sendRawEmail(['Source' => $message->getSender(), 'Destinations' => $this->getTo($message), 'RawMessage' => ['Data' => base64_encode((string) $message)]]); }
/** * {@inheritdoc} */ public function send(Swift_Mime_Message $message, &$failedRecipients = null) { return $this->ses->sendRawEmail(['Source' => key($message->getSender() ?: $message->getFrom()), 'Destinations' => $this->getTo($message), 'RawMessage' => ['Data' => (string) $message]]); }