第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在codeigniter中使用sendgrid api庫作為第三方庫

如何在codeigniter中使用sendgrid api庫作為第三方庫

PHP
浮云間 2022-07-09 10:41:17
如何在 codeigniter 中使用 sendgrid 庫作為第三方。在他們的網(wǎng)站上,我可以找到擴展普通 codeigniter 電子郵件類的 smtp 代碼。有什么幫助嗎?<?php$this->load->library('email');$this->email->initialize(array(  'protocol' => 'smtp',  'smtp_host' => 'smtp.sendgrid.net',  'smtp_user' => 'sendgridusername',  'smtp_pass' => 'sendgridpassword',  'smtp_port' => 587,  'crlf' => "\r\n",  'newline' => "\r\n"));$this->email->from('your@example.com', 'Your Name');$this->email->to('someoneexampexample@example.com');$this->email->cc('another@another-example.com');$this->email->bcc('them@their-example.com');$this->email->subject('Email Test');$this->email->message('Testing the email class.');$this->email->send();echo $this->email->print_debugger();?>
查看完整描述

1 回答

?
夢里花落0921

TA貢獻1772條經(jīng)驗 獲得超6個贊

Step1:將您的 sendgrid 庫復制到第三方文件夾 step2:將以下代碼添加到您的控制器方法


include APPPATH . 'third_party/sendgrid-php/sendgrid-php.php';


        //$this->load->third_party('sendgrid-php');




        $email = new \SendGrid\Mail\Mail();

        $email->setFrom("setfrom@test.com", "testname");

        $email->setSubject("MailTest");

        $email->addTo('tomail@gmail.com', "User");

        $email->addContent("text/plain", "subject");

        $email->addContent(

            "text/html",'<html><body>Message</body><html>');


        $sendgrid = new \SendGrid(('sendgrid-API-KEY_HERE'));

        try {

            $response = $sendgrid->send($email);

            print $response->statusCode() . "\n";

            print_r($response->headers());

            print $response->body() . "\n";

        } catch (Exception $e) {

            echo 'Caught exception: '. $e->getMessage() ."\n";

        }

希望它會工作


查看完整回答
反對 回復 2022-07-09
  • 1 回答
  • 0 關注
  • 99 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號