• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mailgun\Mailgun类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Mailgun\Mailgun的典型用法代码示例。如果您正苦于以下问题:PHP Mailgun类的具体用法?PHP Mailgun怎么用?PHP Mailgun使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Mailgun类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: send

 public function send()
 {
     # Include the Autoloader (see "Libraries" for install instructions)
     # Instantiate the client.
     $mgClient = new Mailgun('');
     $domain = "";
     # Make the call to the client.
     $result = $mgClient->sendMessage($domain, array('from' => 'InfoJr UFBA <[email protected]>', 'to' => 'Você <' . $this->email . '>', 'subject' => 'Capacitação em Git & GitHub - Inscrito', 'text' => $this->name, 'html' => '<html style="width:500px"><style>html{width:500px; text-align:center;} img{width: 100%;} a{padding:5px 15px;}</style><img style="width:100%" src="http://www.infojr.com.br/git-github/assets/img/git-confirm.jpg"></img>
             <a style="padding:5px 15px" href="www.infojr.com.br">www.infojr.com.br</a>
             <a style="padding:5px 15px" href="www.facebook.com/infojrnews">/infojrnews</a>
             </html>'));
     return $result;
 }
开发者ID:InfoJrUFBA,项目名称:git-github,代码行数:13,代码来源:email.php


示例2: setAdressToOkMailGun

 public function setAdressToOkMailGun($recipient)
 {
     $mgClient = new Mailgun(env('Mailgun_Secret_API_Key', false));
     $defaultAddress = env('Mailgun_Forward_Address', false);
     $result = $mgClient->post('routes', ['priority' => 2000, 'expression' => 'match_recipient("' . $recipient . '")', 'action' => ['forward("' . $defaultAddress . '")', 'stop()'], 'description' => 'Ok']);
     return $result->http_response_code . ': ' . $result->http_response_body->message;
 }
开发者ID:Bogstag,项目名称:bogstag.se,代码行数:7,代码来源:EmailDropController.php


示例3: doSend

 /**
  * Sends the email through the Mailgun API.
  * @return \stdClass the Mailgun API response object.
  */
 protected function doSend()
 {
     if (!$this->getDomain()) {
         throw new \Exception('Domain not provided for sending a message through Mailgun. Please set a domain by using the "setDomain($domain)" method.');
     }
     return $this->client->sendMessage($this->getDomain(), $this->getMessage(), $this->getFiles());
 }
开发者ID:leoflapper,项目名称:mailprovider,代码行数:11,代码来源:Mailgun.php


示例4: sendmail

 public function sendmail($to, $from, $subject, $message)
 {
     $mgClient = new Mailgun('key-6fe06142d08a9e9c3989f3731bd1d6c0');
     $domain = "monithor.net";
     # Make the call to the client.
     $result = $mgClient->sendMessage($domain, array('from' => $from, 'to' => $to, 'subject' => $subject, 'text' => $message));
 }
开发者ID:Llano,项目名称:monithorweb,代码行数:7,代码来源:MailLib.php


示例5: email_mailgun

function email_mailgun($api_key, $api_domain, $params)
{
    $_mailgun_api_key = $api_key;
    $_mailgun_domain = $api_domain;
    $_mailgun_from = $params['from'];
    $_mailgun_to = $params['to'];
    $_mailgun_subject = $params['subject'];
    $_mailgun_text = $params['msg'];
    $mg = new Mailgun($_mailgun_api_key);
    $domain = $_mailgun_domain;
    # Now, compose and send your message.
    $mg->sendMessage($domain, array('from' => $_mailgun_from, 'to' => $_mailgun_to, 'subject' => $_mailgun_subject, 'html' => $_mailgun_text));
    /* --- COUNTER --- */
    /*
    $_date = date('Y-m-d');
    $_mailgun_count = $_mailgun->count_email($_date);
    
    if($_mailgun_count->rows > 0){
       $_mailgun_data = $_mailgun->get_email($_date);
    	  $_mailgun->update_counter($_mailgun_data->date, ($_mailgun_data->counter + 1), $_mailgun_data->status, $_mailgun_data->id);
    }else{
       $_update->insert_counter($_date, 1, 1);
    }
    */
}
开发者ID:nickyudha,项目名称:spalosophy,代码行数:25,代码来源:_mailgun.php


示例6: postSendMail

 public function postSendMail()
 {
     if (!\Input::has('subject') && !\Input::has('message')) {
         return \Response::json(['type' => 'danger', 'message' => 'Email data not complete.']);
     }
     $recipients = \NewsLetter::getAllRecipients();
     if (count($recipients) > 0) {
         $recipientsTo = [];
         foreach ($recipients as $recipient) {
             $recipientsTo[$recipient->email] = ['email' => $recipient->email];
         }
         try {
             $mg = new Mailgun(env('MAILGUN_PRIVATE_KEY'));
             $data = ['content' => \Input::get('message')];
             $inliner = new EmailInliner('emails.newsletter', $data);
             $content = $inliner->convert();
             $mg->sendMessage('programmechameleon.com', ['from' => '[email protected]', 'to' => implode(",", array_keys($recipientsTo)), 'subject' => \Input::get('subject'), 'html' => $content, 'text' => 'Programme Chameleon Text Message', 'recipient-variables' => json_encode($recipientsTo)]);
             return \Response::json(['type' => 'success', 'message' => 'Message successfully sent.']);
         } catch (\Exception $e) {
             return \Response::json(['type' => 'danger', 'message' => $e->getMessage()]);
         }
     } else {
         return \Response::json(['type' => 'danger', 'message' => 'No emails to send.']);
     }
 }
开发者ID:phantomlight,项目名称:programme-chameleon,代码行数:25,代码来源:NewsLetterController.php


示例7: addList

 public function addList()
 {
     # Instantiate the client.
     $mgClient = new Mailgun('YOUR_API_KEY');
     # Issue the call to the client.
     $result = $mgClient->post("lists", array('address' => 'LIST@YOUR_DOMAIN_NAME', 'description' => 'Mailgun Dev List'));
 }
开发者ID:shockwave-design,项目名称:magento2-module-mail-mailgun,代码行数:7,代码来源:MailgunList.php


示例8: sendEmail

 /**
  * Sends an email using MailGun
  * @author salvipascual
  * @param String $to, email address of the receiver
  * @param String $subject, subject of the email
  * @param String $body, body of the email in HTML
  * @param Array $images, paths to the images to embeb
  * @param Array $attachments, paths to the files to attach 
  * */
 public function sendEmail($to, $subject, $body, $images = array(), $attachments = array())
 {
     // do not email if there is an error
     $response = $this->deliveryStatus($to);
     if ($response != 'ok') {
         return;
     }
     // select the from email using the jumper
     $from = $this->nextEmail($to);
     $domain = explode("@", $from)[1];
     // create the list of images
     if (!empty($images)) {
         $images = array('inline' => $images);
     }
     // crate the list of attachments
     // TODO add list of attachments
     // create the array send
     $message = array("from" => "Apretaste <{$from}>", "to" => $to, "subject" => $subject, "html" => $body, "o:tracking" => false, "o:tracking-clicks" => false, "o:tracking-opens" => false);
     // get the key from the config
     $di = \Phalcon\DI\FactoryDefault::getDefault();
     $mailgunKey = $di->get('config')['mailgun']['key'];
     // send the email via MailGun
     $mgClient = new Mailgun($mailgunKey);
     $result = $mgClient->sendMessage($domain, $message, $images);
 }
开发者ID:ChrisClement,项目名称:Core,代码行数:34,代码来源:Email.php


示例9: send

 /**
  * Send email via Mailgun
  *
  * @param CakeEmail $email
  * @return array
  * @throws Exception
  */
 public function send(CakeEmail $email)
 {
     if (Configure::read('Mailgun.preventManyToRecipients') !== false && count($email->to()) > 1) {
         throw new Exception('More than one "to" recipient not allowed (set Mailgun.preventManyToRecipients = false to disable check)');
     }
     $mgClient = new Mailgun($this->_config['mg_api_key']);
     $headersList = array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject');
     $params = [];
     foreach ($email->getHeaders($headersList) as $header => $value) {
         if (isset($this->_paramMapping[$header]) && !empty($value)) {
             $key = $this->_paramMapping[$header];
             $params[$key] = $value;
         }
     }
     $params['text'] = $email->message(CakeEmail::MESSAGE_TEXT);
     $params['html'] = $email->message(CakeEmail::MESSAGE_HTML);
     $attachments = array();
     foreach ($email->attachments() as $name => $info) {
         $attachments['attachment'][] = '@' . $info['file'];
     }
     try {
         $result = $mgClient->sendMessage($this->_config['mg_domain'], $params, $attachments);
         if ($result->http_response_code != 200) {
             throw new Exception($result->http_response_body->message);
         }
     } catch (Exception $e) {
         throw $e;
     }
     return $result;
 }
开发者ID:codaxis,项目名称:cakephp-mailgun,代码行数:37,代码来源:MailgunTransport.php


示例10: sendReceipt

 public function sendReceipt(Cart $cart)
 {
     $mg = new Mailgun(self::API_KEY);
     $domain = "mg.fullprintcamping.com";
     $user = $cart->user()->first();
     $response = $mg->sendMessage($domain, array('from' => '[email protected]', 'to' => $user->email, 'subject' => "Your order at FullPrintCamping.com", 'text' => "fullprintcamping.com/order-details/" . $cart->id));
     var_dump($response);
 }
开发者ID:hogggy,项目名称:infinite-wonder,代码行数:8,代码来源:EmailUtil.php


示例11: SendEmail

function SendEmail($to_email, $subject, $mail_text)
{
    # Instantiate the client.
    $mgClient = new Mailgun('key-9ugjcrpnblx1m98gcpyqejyi75a96ta5');
    //$domain = "sandbox40726.mailgun.org";
    $domain = "Poolski.com";
    # Make the call to the client.
    $result = $mgClient->sendMessage("{$domain}", array('from' => 'Poolski <[email protected]>', 'to' => $to_email, 'subject' => $subject, 'text' => $mail_text));
}
开发者ID:epsilon670,项目名称:Poolski,代码行数:9,代码来源:send_mail.php


示例12: index

 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $this->load->library('encrypt');
     $mg = new Mailgun("key-03bbdd374175cab763318e141fb293ec");
     $domain = "sandbox750e37e111ff4d03a61fe980e1f94dee.mailgun.org";
     # Now, compose and send your message.
     $mg->sendMessage($domain, array('from' => '[email protected]', 'to' => '[email protected]', 'subject' => 'The PHP SDK is awesome!', 'text' => 'It is so simple to send a message.'));
     //print_r($result);
     $this->load->view('welcome_message');
 }
开发者ID:anoopkp06,项目名称:guestlist,代码行数:25,代码来源:Welcome.php


示例13: __invoke

 /**
  * Show mailgun status
  *
  * @return Response
  */
 public function __invoke()
 {
     $mg = new Mailgun(env('MAILGUN_API_KEY'));
     $domain = env('MAILGUN_DOMAIN');
     //TODO better error handling if mailgun API is not accessible
     $logs = $mg->get("{$domain}/log", array('limit' => 16, 'skip' => 0))->http_response_body->items;
     $domainResponse = $mg->get("domains/{$domain}");
     $domain = $domainResponse->http_response_body->domain;
     $responseCode = $domainResponse->http_response_code;
     return view('admin.mailgun.index', compact('logs', 'domain', 'responseCode'));
 }
开发者ID:mattvb91,项目名称:website-laravel,代码行数:16,代码来源:MailgunController.php


示例14: countryNotFoundHandler

 /**
  *Handler to an event, when a country is not found in the Country Filter of a survey.
  */
 public function countryNotFoundHandler($survey_id)
 {
     # Instantiate the client.
     $mgClient = new Mailgun('key-ef43176cf355dd4eab5649acb1c89d0c');
     $domain = "hopstek.com";
     $to = "[email protected]";
     $subject = "Country Filter is not working";
     $message = "Hi,\r\n\r\n" . "One of the survey's country filter is not working correctly.\r\n\r\n" . "Visit to the survey by clicking on below URL:\r\n\r\n" . "http://" . $_SERVER['HTTP_HOST'] . "/" . str_replace("\\", "/", substr(getcwd(), strlen($_SERVER['DOCUMENT_ROOT']))) . "/view_survey_details.php?survey_id=" . $survey_id . "\r\n\r\n" . "Regards,\r\nSMT";
     # Make the call to the client.
     $result = $mgClient->sendMessage($domain, array('from' => 'SMT <[email protected]>', 'to' => $to, 'subject' => $subject, 'text' => $message));
 }
开发者ID:piyushsh,项目名称:smt,代码行数:14,代码来源:CountryFilterEventHandler.php


示例15: sendInviteEmail

 public function sendInviteEmail($to_emails, $from_user, $code, $goupname)
 {
     $mg = new Mailgun($this->api_key);
     $domain = "collabii.com";
     $rt = array();
     foreach ($to_emails as $email) {
         # Now, compose and send your message.
         $rt[] = $mg->sendMessage($domain, array('from' => '[email protected]', 'to' => $to_emails, 'subject' => 'Collabii Invite From ' . $from_user->get('name'), 'html' => '<img src="http://www.collabii.com/img/logo.png" alt="Collabii"/><p>Hi, ' . $from_user->get('name') . ' has invited you to join a Collabii group.  Just click on the invite link below.</p>
                             <a href="http://www.collabii.com/joingroup/email/' . $code . '">' . $goupname . '</a>'));
     }
     return $rt;
 }
开发者ID:samphomsopha,项目名称:codelab,代码行数:12,代码来源:Send.php


示例16: validateMailgun

 public function validateMailgun($attribute, $value, $parameters)
 {
     $mgClient = new Mailgun($value);
     try {
         $result = $mgClient->get("domains");
     } catch (\Mailgun\Connection\Exceptions\InvalidCredentials $e) {
         return false;
     } catch (GenericHTTPError $e) {
         return false;
     }
     return true;
 }
开发者ID:jeanfrancis,项目名称:faxbox,代码行数:12,代码来源:CustomLaravelValidator.php


示例17: sendEmail

 public function sendEmail($templateFile)
 {
     extract($this->data);
     # Instantiate the client.
     $mgClient = new Mailgun('MAILGUN_KEY');
     $domain = MAILGUN_DOMAIN;
     ob_start();
     include $templateFile;
     $emailBody = ob_get_clean();
     # Make the call to the client.
     $result = $mgClient->sendMessage($domain, array('from' => $emailHeader['from'], 'to' => $emailHeader['to'], 'subject' => $emailHeader['subject'], 'text' => $emailBody));
 }
开发者ID:kristyramage,项目名称:schlocktoberfest,代码行数:12,代码来源:EmailView.php


示例18: send

 /**
  * Implementation of Send method
  * ============================
  *
  * Parse Nette\Mail\Message and send vie Mailgun
  * @param \Nette\Mail\Message $mail
  */
 public function send(Message $mail)
 {
     $nMail = clone $mail;
     $cFrom = $nMail->getHeader('Return-Path') ?: key($nMail->getHeader('From'));
     $to = $this->generateMultiString((array) $nMail->getHeader('To'));
     $cc = $this->generateMultiString((array) $nMail->getHeader('Cc'));
     $bcc = $this->generateMultiString((array) $nMail->getHeader('Bcc'));
     $nMail->setHeader('Bcc', NULL);
     $data = $nMail->generateMessage();
     $cData = preg_replace('#^\\.#m', '..', $data);
     return $this->mg->sendMessage($this->domain, array('from' => $cFrom, 'to' => $to, 'cc' => $cc, 'bcc' => $bcc), $cData);
 }
开发者ID:profectsro,项目名称:mailgun-mailer,代码行数:19,代码来源:MgMailer.php


示例19: sendVerificationEmail

 public function sendVerificationEmail($where, $what)
 {
     # First, instantiate the SDK with your API credentials and define your domain.
     $msg = new Mailgun(Config::get('mailgun/secret'));
     $domain = Config::get('info/domain');
     # Now, compose and send your message.
     $msg->sendMessage($domain, array('from' => Config::get('mailgun/from_email'), 'to' => $where, 'subject' => "Your BernBuds email validation code is: {$what}", 'text' => "Your BernBuds email validation code is: {$what}"));
     $result = $msg->get("{$domain}/log", array('limit' => 1, 'skip' => 0));
     $httpResponseCode = $result->http_response_code;
     $httpResponseBody = $result->http_response_body;
     return $httpResponseBody;
 }
开发者ID:bernbuds,项目名称:website,代码行数:12,代码来源:Mailer.php


示例20: sendMessage

 /**
  * Send a mail using this transport
  *
  * @return void
  */
 public function sendMessage()
 {
     // If Mailgun Service is disabled, use the default mail transport
     if (!$this->config->enabled()) {
         parent::sendMessage();
         return;
     }
     $messageBuilder = $this->createMailgunMessage($this->parseMessage());
     $mailgun = new Mailgun($this->config->privateKey(), $this->getHttpClient(), $this->config->endpoint());
     $mailgun->setApiVersion($this->config->version());
     $mailgun->setSslEnabled($this->config->ssl());
     $mailgun->sendMessage($this->config->domain(), $messageBuilder->getMessage(), $messageBuilder->getFiles());
 }
开发者ID:bogardo,项目名称:mailgun-magento2,代码行数:18,代码来源:Transport.php



注:本文中的Mailgun\Mailgun类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Base\Utils类代码示例发布时间:2022-05-23
下一篇:
PHP Helper\Data类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap