通过sendgrid通过azure Web应用发送电子邮件

时间:2018-11-21 20:54:52

标签: php azure post sendgrid html-form-post

我有一个在Azure上运行的网站,并且能够接收电子邮件。 我的天青安装了Sendgrid帐户。 但是我有订阅者表格,我需要向订阅者发送感谢电子邮件。我无法弄清楚如何将表单数据放入我的php sendgrid文件中。 请帮助我获取表格数据到php。

SELECT  REGEXP_REPLACE('G,-1 = G',
                         '([[:alpha:]]+\,*[[:digit:]]*)', 
                        'grouped(\1)') 

                 as  "REGEXP_REPLACE_Concatenation"
FROM dual;

HTML文件

My action_page.php file
    <?php

$url = 'https://api.sendgrid.com/';
$user = 'username';
$pass = 'pwd'; 

$params = array(
    'api_user'  => $user,
    'api_key'   => $pass,
    'to'        => 'subscriber email',
    'subject'   => 'testing from curl',
    'html'      => 'testing body',
    'text'      => 'testing body',
    'from'      => 'company email',
  );


$request =  $url.'api/mail.send.json';

// Generate curl request
$session = curl_init($request);
// Tell curl to use HTTP POST
curl_setopt ($session, CURLOPT_POST, true);
// Tell curl that this is the body of the POST
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);

// obtain response
$response = curl_exec($session);
curl_close($session);

// print everything out
print_r($response);

?>

0 个答案:

没有答案