Exemplo n.º 1
1
 /**
  * {@inheritDoc}
  */
 public function createSendGridEmail(EmailInterface $email)
 {
     $sendGridEmail = new SendGridEmail();
     $sendGridEmail->to = $email->getTo();
     $sendGridEmail->setFrom($email->getFrom());
     $sendGridEmail->setFromName($email->getFromName());
     $sendGridEmail->setSubject($email->getSubject());
     $sendGridEmail->setText($email->getBodyText());
     $sendGridEmail->setHtml($email->getBodyHtml());
     if (is_array($email->getAttachments())) {
         $sendGridEmail->setAttachments($email->getAttachments());
     }
     if ($email instanceof EmailDecorator) {
         $sendGridEmail->setCategories($email->getCategories());
         if (!is_null($email->getSendAt())) {
             $sendGridEmail->setSendAt($email->getSendAt());
         }
     }
     return $sendGridEmail;
 }
Exemplo n.º 2
0
 public function perform()
 {
     $sendgrid = new SendGrid($this->config['username'], $this->config['password']);
     $email = new SendGrid\Email();
     $email->addTo($this->args['to'])->setFrom($this->args['from'])->setSubject($this->args['subject'])->setText($this->args['body'])->setHtml($this->args['body']);
     return $sendgrid->send($email);
 }
Exemplo n.º 3
0
 /**
  * @param string $from
  * @param string $to
  * @param string $message
  * @param string $subject
  *
  * @return \stdClass
  */
 protected function sendMail($from, $to, $message, $subject)
 {
     $sendGrind = new \SendGrid($this->username, $this->password);
     $email = new Email();
     $email->addTo($from)->addTo($to)->setSubject($subject)->setText(strip_tags($message))->setHtml($message);
     return $sendGrind->send($email);
 }
Exemplo n.º 4
0
 private function sendEmail($to, $from, $subject, $html)
 {
     $sendgrid = new SendGrid('arsen007', 'qqqqqq');
     $email = new SendGrid\Email();
     $email->addTo($to)->setFrom($from)->setSubject($subject)->setHtml($html);
     return $sendgrid->send($email);
 }
Exemplo n.º 5
0
 public static function mail($destinataire, $objet, $message)
 {
     $sendgrid = new SendGrid("MON API KEY");
     // API-KEY
     $email = new SendGrid\Email();
     $email->addTo($destinataire)->setFrom("*****@*****.**")->setSubject($objet)->setHtml($message);
     $sendgrid->send($email);
 }
 public function perform()
 {
     //$this->tm->render('index.html.twig', array('a' => 'dimi'));
     $sendgrid = new SendGrid($this->config['username'], $this->config['password']);
     $email = new SendGrid\Email();
     $email->addTo($this->args['to'])->setFrom($this->args['from'])->setSubject($this->args['subject'])->setText($this->tm->render('index.html.twig', array('a' => 'dimi')))->setHtml($this->tm->render('index.html.twig', array('a' => 'dimi')));
     return $sendgrid->send($email);
 }
Exemplo n.º 7
0
 /**
  * @param string         $body
  * @param EmailInterface $email
  * @return boolean
  */
 protected function doSend($body, EmailInterface $email)
 {
     /** @var SendGridEmail $sendgridEmail */
     $sendgridEmail = new SendGridEmail();
     $sendgridEmail->addTo($email->getTo())->setFrom($email->getFrom())->setSubject($email->getSubject())->addCc($email->getCc())->setBcc($email->getBcc())->setHtml($body);
     /** @var Response $res */
     $res = static::getSendGrid()->send($sendgridEmail);
     return $res->getCode() === 200;
 }
 public function send($message)
 {
     $SendGridLight = $this->app['eccube.plugin.repository.sendgridlight']->find(1);
     if (!$SendGridLight) {
         throw new \Exception('SendGrid not found.');
     }
     $sendgrid = new SendGrid($SendGridLight->getApiUser(), $SendGridLight->getApiKey());
     $email = new Email();
     //$name = array('Elmer');
     $to = $message->getTo();
     $to_emails = array_keys($to);
     $from = $message->getFrom();
     $from_emails = array_keys($from);
     $email->addTo($to_emails[0])->setFrom($from_emails[0])->setSubject($message->getSubject())->setText($message->getBody())->setBcc($message->getBcc())->setReplyTo($message->getReplyTo());
     $sendgrid->send($email);
 }
 public function sendEmail(Email $email)
 {
     $apiKeys = env("SENDGRID_APIKEY");
     if (is_null($apiKeys)) {
         throw new SendgridServiceException();
     }
     if (!$email->getFrom()) {
         throw new SendgridServiceException();
     }
     $sendgrid = new \SendGrid($apiKeys);
     try {
         $sendgrid->send($email);
     } catch (\Exception $e) {
         var_dump($e->getMessage());
         throw new SendgridServiceException();
     }
 }
Exemplo n.º 10
0
    public function sendGridReset($email, $link)
    {
        $mailHtml = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>GreenHopping</title>
<script type="text/javascript">
//<![CDATA[
try{if (!window.CloudFlare) {var CloudFlare=[{verbose:0,p:0,byc:0,owlid:"cf",bag2:1,mirage2:0,oracle:0,paths:{cloudflare:"/cdn-cgi/nexp/dok3v=1613a3a185/"},atok:"c50cc9be038eff534235017b430ed633",petok:"05521d0d16aca7c407e6f17a5f2291847a8dd3c5-1449817077-1800",zone:"adbee.technology",rocket:"0",apps:{"ga_key":{"ua":"UA-49262924-2","ga_bs":"2"}},sha2test:0}];!function(a,b){a=document.createElement("script"),b=document.getElementsByTagName("script")[0],a.async=!0,a.src="../ajax.cloudflare.com/cdn-cgi/nexp/dok3v%3d38857570ac/cloudflare.min.js",b.parentNode.insertBefore(a,b)}()}}catch(e){};
//]]>
</script>
<style type="text/css">#outlook a{padding:0;}.ReadMsgBody{width:100%;}.ExternalClass{width:100%;}.ExternalClass,.ExternalClass p,.ExternalClass span,.ExternalClass font,.ExternalClass td,.ExternalClass div{line-height:100%;}body,table,td,p,a,li,blockquote{-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%;}table,td{mso-table-lspace:0pt;mso-table-rspace:0pt;}img{-ms-interpolation-mode:bicubic;}body{margin:0;padding:0;}img{border:0;height:auto;line-height:100%;outline:none;text-decoration:none;}table{border-collapse:collapse!important;}body,#bodyTable,#bodyCell{height:100%!important;margin:0;padding:0;width:100%!important;}#bodyCell{padding:20px;}#templateContainer{width:600px;}body,#bodyTable{background-color:#EEEEEE;}#bodyCell{border-top:4px solid #BBBBBB;}#templateContainer{border:1px solid #BBBBBB;}h1{color:#202020!important;display:block;font-family:Helvetica;font-size:26px;font-style:normal;font-weight:bold;line-height:100%;letter-spacing:normal;margin-top:0;margin-right:0;margin-bottom:10px;margin-left:0;text-align:left;}h2{color:#404040!important;display:block;font-family:Helvetica;font-size:20px;font-style:normal;font-weight:bold;line-height:100%;letter-spacing:normal;margin-top:0;margin-right:0;margin-bottom:10px;margin-left:0;text-align:left;}h3{color:#606060!important;display:block;font-family:Helvetica;font-size:16px;font-style:italic;font-weight:normal;line-height:100%;letter-spacing:normal;margin-top:0;margin-right:0;margin-bottom:10px;margin-left:0;text-align:left;}h4{color:#808080!important;display:block;font-family:Helvetica;font-size:14px;font-style:italic;font-weight:normal;line-height:100%;letter-spacing:normal;margin-top:0;margin-right:0;margin-bottom:10px;margin-left:0;text-align:left;}#templatePreheader{background-color:#F4F4F4;border-bottom:1px solid #CCCCCC;}.preheaderContent{color:#808080;font-family:Helvetica;font-size:10px;line-height:125%;text-align:left;}.preheaderContent a:link,.preheaderContent a:visited,.preheaderContent a .yshortcuts{color:#606060;font-weight:normal;text-decoration:underline;}#templateHeader{background-color:#F4F4F4;border-bottom:1px solid #CCCCCC;}.headerContent{color:#505050;font-family:Helvetica;font-size:20px;font-weight:bold;line-height:100%;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0;text-align:left;vertical-align:middle;}.headerContent a:link,.headerContent a:visited,.headerContent a .yshortcuts{color:#03a9f4;font-weight:normal;text-decoration:underline;}#headerImage{height:auto;max-width:600px;}#templateBody{background-color:#F4F4F4;border-top:1px solid #FFFFFF;border-bottom:1px solid #CCCCCC;}.bodyContent{color:#505050;font-family:Helvetica;font-size:16px;line-height:150%;padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px;text-align:left;}.bodyContent a:link,.bodyContent a:visited,.bodyContent a .yshortcuts{color:#03a9f4;font-weight:normal;text-decoration:underline;}.bodyContent img{display:inline;height:auto;max-width:560px;}.templateColumnContainer{width:200px;}#templateColumns{background-color:#F4F4F4;border-top:1px solid #FFFFFF;border-bottom:1px solid #CCCCCC;}.leftColumnContent{color:#505050;font-family:Helvetica;font-size:14px;line-height:150%;padding-top:0;padding-right:20px;padding-bottom:20px;padding-left:20px;text-align:left;}.leftColumnContent a:link,.leftColumnContent a:visited,.leftColumnContent a .yshortcuts{color:#03a9f4;font-weight:normal;text-decoration:underline;}.centerColumnContent{color:#505050;font-family:Helvetica;font-size:14px;line-height:150%;padding-top:0;padding-right:20px;padding-bottom:20px;padding-left:20px;text-align:left;}.centerColumnContent a:link,.centerColumnContent a:visited,.centerColumnContent a .yshortcuts{color:#03a9f4;font-weight:normal;text-decoration:underline;}.rightColumnContent{color:#505050;font-family:Helvetica;font-size:14px;line-height:150%;padding-top:0;padding-right:20px;padding-bottom:20px;padding-left:20px;text-align:left;}.rightColumnContent a:link,.rightColumnContent a:visited,.rightColumnContent a .yshortcuts{color:#03a9f4;font-weight:normal;text-decoration:underline;}.leftColumnContent img,.rightColumnContent img{display:inline;height:auto;max-width:260px;}#templateFooter{background-color:#F4F4F4;border-top:1px solid #FFFFFF;}.footerContent{color:#808080;font-family:Helvetica;font-size:10px;line-height:150%;padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px;text-align:left;}.footerContent a:link,.footerContent a:visited,.footerContent a .yshortcuts,.footerContent a span{color:#606060;font-weight:normal;text-decoration:underline;}@media only screen and (max-width: 480px){body,table,td,p,a,li,blockquote{-webkit-text-size-adjust:none!important;}body{width:100%!important;min-width:100%!important;}#bodyCell{padding:10px!important;}#templateContainer{max-width:600px!important;width:100%!important;}h1{font-size:24px!important;line-height:100%!important;}h2{font-size:20px!important;line-height:100%!important;}h3{font-size:18px!important;line-height:100%!important;}h4{font-size:16px!important;line-height:100%!important;}#templatePreheader{display:none!important;}#headerImage{height:auto!important;max-width:600px!important;width:100%!important;}.headerContent{font-size:20px!important;line-height:125%!important;}.bodyContent{font-size:18px!important;line-height:125%!important;}.templateColumnContainer{display:block!important;width:100%!important;}.columnImage{height:auto!important;max-width:480px!important;width:100%!important;}.leftColumnContent{font-size:16px!important;line-height:125%!important;}.centerColumnContent{font-size:16px!important;line-height:125%!important;}.rightColumnContent{font-size:16px!important;line-height:125%!important;}.footerContent{font-size:14px!important;line-height:115%!important;}.footerContent a{display:block!important;}}</style>
</head>
<body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0">
<center>
<table align="center" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" id="bodyTable">
<tr>
<td align="center" valign="top" id="bodyCell">
 
<table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
<tr>
<td align="center" valign="top">
 
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templatePreheader">
<tr>
<td valign="top" class="preheaderContent" style="padding-top:10px; padding-right:20px; padding-bottom:10px; padding-left:20px;" mc:edit="preheader_content00">
GreenHopping Reset Password EMail
</td>
 
<td valign="top" width="180" class="preheaderContent" style="padding-top:10px; padding-right:20px; padding-bottom:10px; padding-left:0;" mc:edit="preheader_content01">
Email not displaying correctly?<br/><a href="#" target="_blank">View it in your browser</a>.
</td>
 
</tr>
</table>
 
</td>
</tr>
<tr>
<td align="center" valign="top">
 
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateHeader">
<tr>
<td valign="top" class="headerContent">
<center>
<img src="http://www.self.com/wp-content/uploads/2014/06/GreenHopping-App-700x700.jpg" style="max-width:200px;" style="max-height:200px;" id="headerImage" mc:label="header_image" mc:edit="header_image" mc:allowdesigner mc:allowtext />
</center>
</td>
</tr>
</table>
 
</td>
</tr>
<tr>
<td align="center" valign="top">
 
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateBody">
<tr>
<td valign="top" class="bodyContent" mc:edit="body_content">
<h1>Welcome to GreenHopping</h1>
<h3>Find Organic Juice Store near you</h3>
Youre receiving this email because your email - <b>{{email}}</b> is used in GreenHopping Account
<br/>
<br/>
<h2>Reset your Password</h2>
<h4>And Start Hopping</h4>
Please click on following <b><a href="http://wekancode.com/greenhopping/reset/{{link}}" target="_blank">link</a></b> to reset your password.
</td>
</tr>
</table>
 
</td>
</tr>
<tr>
<td align="center" valign="top">
 
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateColumns">
<tr mc:repeatable>
<td align="center" valign="top" class="templateColumnContainer" style="padding-top:20px;">
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td class="leftColumnContent">
<img src="http://s27.postimg.org/6tdo0rtnz/image.png" style="max-width:160px;" class="columnImage" mc:label="left_column_image" mc:edit="left_column_image"/>
</td>
</tr>
<tr>
<td valign="top" class="leftColumnContent" mc:edit="left_column_content">
<h3>Juice Press</h3>
<a href="http://kb.mailchimp.com/article/how-do-i-work-with-repeatable-content-blocks" target="_blank">Juice Press</a> are noted with plus and good for health.
<br/>
<br/>
You can go to greenhoppingapp.com to know more about it.
</td>
</tr>
</table>
</td>
<td align="center" valign="top" class="templateColumnContainer" style="padding-top:20px;">
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td class="centerColumnContent">
<img src="http://s4.postimg.org/ycjetqba1/image.png" style="max-width:160px;" class="columnImage" mc:label="center_column_image" mc:edit="center_column_image"/>
</td>
</tr>
<tr>
<td valign="top" class="centerColumnContent" mc:edit="center_column_content">
<h3>Gluten Free</h3>
<a href="a.com" target="_blank">Gluten Free</a> are noted with plus and minus signs so that you can add and subtract content blocks.
<br/>
<br/>
You can go to greenhoppingapp.com to know more about it.
</td>
</tr>
</table>
</td>
<td align="center" valign="top" class="templateColumnContainer" style="padding-top:20px;">
<table border="0" cellpadding="20" cellspacing="0" width="100%">
<tr>
<td class="rightColumnContent">
<img src="http://s9.postimg.org/ag51056u3/image.png" style="max-width:160px;" class="columnImage" mc:label="right_column_image" mc:edit="right_column_image"/>
</td>
</tr>
<tr>
<td valign="top" class="rightColumnContent" mc:edit="right_column_content">
<h3>Glo Mini</h3>
<a href="a.com" target="_blank">Glo Mini</a> are noted with plus and minus signs so that you can add and subtract content blocks.
<br/>
<br/>
You can go to greenhoppingapp.com to know more about it.
</td>
</tr>
</table>
</td>
</tr>
</table>
 
</td>
</tr>
<tr>
<td align="center" valign="top">
 
<table border="0" cellpadding="0" cellspacing="0" width="100%" id="templateFooter">
<tr>
<td valign="top" class="footerContent" mc:edit="footer_content00">
<a href="twitter.com">Follow on Twitter</a>&nbsp;&nbsp;&nbsp;<a href="__FACEBOOK_PROFILEURL__.html">Friend on Facebook</a>&nbsp;&nbsp;&nbsp;<a href="__FORWARD__.html">Forward to Friend</a>&nbsp;
</td>
</tr>
<tr>
<td valign="top" class="footerContent" style="padding-top:0;" mc:edit="footer_content01">
<em>Copyright &copy; 2015 GreenHopping, All rights reserved.</em>
<br/>
<br/>
<strong>Our mailing address is:</strong>
<br/>
US, Some Address at Greenhopping
</td>
</tr>
<tr>
<td valign="top" class="footerContent" style="padding-top:0;" mc:edit="footer_content02">
<a href="__UNSUB__.html">unsubscribe from this list</a>&nbsp;&nbsp;&nbsp;<a href="__UPDATE_PROFILE__.html">update subscription preferences</a>&nbsp;
</td>
</tr>
</table>
 
</td>
</tr>
</table>
 
</td>
</tr>
</table>
</center>
</body>


</html>';
        $emails = $email;
        $mailHtml = str_replace("{{email}}", $email, $mailHtml);
        $mailHtml = str_replace("{{link}}", $link, $mailHtml);
        $sendgrid = new SendGrid('*****@*****.**', 'w1nkyxq19703');
        $email = new SendGrid\Email();
        $email->addTo($emails)->setFrom('*****@*****.**')->setSubject('GreenHopping Reset Email')->setHtml($mailHtml);
        $sendgrid->send($email);
    }
 protected static function buildBaseEmail(array $from, array $to, $subject, array $additionalHeaders = array())
 {
     $email = new Email();
     $fromAddress = current(array_keys($from));
     $fromName = current($from);
     $email->setFrom($fromAddress)->setFromName($fromName)->setSubject($subject);
     // Set to headers
     foreach ($to as $toAddress => $toName) {
         $email->addTo($toAddress, $toName);
     }
     // Set CC header if a value is given
     if (isset($additionalHeaders["cc"]) && is_array($cc = $additionalHeaders["cc"])) {
         $email->setCcs($cc);
     }
     // Set BCC header if a valud is given
     if (isset($additionalHeaders["bcc"]) && is_array($bcc = $additionalHeaders["bcc"])) {
         $email->setBccs($bcc);
     }
     if (isset($additionalHeaders["reply-to"])) {
         $email->setReplyTo($additionalHeaders["reply-to"]);
     }
     return $email;
 }
Exemplo n.º 12
0
 /**
  * Deliver the email.
  *
  * @return void
  */
 public function deliver()
 {
     $html = view($this->view)->with($this->data)->render();
     if (env('APP_ENV') != 'production') {
         \Log::info($html);
     } else {
         $sendgrid = new SendGrid(env('SEND_GRID_API_KEY'));
         $email = new Email();
         $email->addTo($this->to)->setFrom("*****@*****.**")->setSubject($this->subject)->setHtml($html);
         $sendgrid->send($email);
     }
 }
Exemplo n.º 13
0
 /**
  * In SendGrid sections are used only with connection to substitutions.
  * Here, we're adding 'fake' substitutions that use defined sections.
  *
  * @param \SendGrid\Email $email
  * @return void
  */
 protected function setSections(\SendGrid\Email $email)
 {
     if (false === empty($this->globalVariables)) {
         foreach ($this->globalVariables as $name => $value) {
             /** @var Variable $globalVariable */
             $sectionName = $name . '_SECTION';
             $substitution = array_fill(0, count($this->recipients), $sectionName);
             $email->addSection($sectionName, $value);
             $email->addSubstitution($name, $substitution);
         }
     }
 }
 /**
  * @param Message $message
  * @return bool
  */
 public function send(Message $message)
 {
     $this->email->addTo($message->getTo()->current()->getEmail(), $message->getTo()->current()->getName())->setFrom($message->getFrom()->current()->getEmail(), $message->getFrom()->current()->getName())->setSubject($message->getSubject())->setHtml($message->getBodyText());
     $this->sendGrid->send($this->email);
     return true;
 }
Exemplo n.º 15
0
 /**
  * Get all headers from the message.
  *
  * @return array
  */
 public function getHeaders()
 {
     return $this->message->getHeaders();
 }
Exemplo n.º 16
0
 private function createMessage($body, $data, $config)
 {
     $message = new Email();
     $message->setFrom($config['from']['email'])->setSubject($config['subject'])->setHtml($body)->addTo($data->getEmail())->addUniqueArg('hash', $this->createHash())->addHeader('hash', $this->createHash());
     return $message;
 }