彰化一整天的論壇

 找回密碼
 立即註冊
查看: 164|回復: 0

Send mail on google compute engine instance

[複製鏈接]
發表於 2019-5-9 16:37:03 | 顯示全部樓層 |閱讀模式
  1. $url = 'https://api.sendgrid.com/';
  2. $pass = 'AK.txxxxxxxxxxxxxxxix';
  3. $params = array(
  4.     'to'        => "xxx@gmail.com.tw",
  5.     'subject'   => "test title",
  6.     'html'      => "test content",
  7.     'from'      => "admin" . '<admin@www.puritys.me>',
  8.   );

  9. $header = array(
  10.     'Authorization: Bearer ' . $pass,
  11. );

  12. $request =  $url.'api/mail.send.json';
  13. $session = curl_init($request);
  14. curl_setopt ($session, CURLOPT_POST, true);
  15. curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
  16. curl_setopt ($session, CURLOPT_HEADER, false);
  17. curl_setopt ($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
  18. curl_setopt ($session, CURLOPT_RETURNTRANSFER, true);
  19. curl_setopt ($session, CURLOPT_HTTPHEADER, $header);
  20. $response = curl_exec($session);
  21. curl_close($session);
複製代碼


文章來源: https://www.puritys.me/docs-blog/article-330-Send-mail-on-google-compute-engine-instance.html
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

 ㄚ母滴雞湯
 員林香純滴雞精

Archiver|手機版|小黑屋|彰化一整天的論壇(Excel,Office)  |网站地图

GMT+8, 2019-10-23 11:34 , Processed in 0.106041 second(s), 19 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表