PHP SendGrid-未收到响应
让SendGrid处理我的Azure订阅时遇到了一些大问题。它根本不发送电子邮件!我遵循了教程,代码基本上是从他们那里复制的,但电子邮件不会发送到我的地址。下面的代码用于我的联系方式 我主要关心的是PHP SendGrid-未收到响应,php,azure,curl,sendgrid,Php,Azure,Curl,Sendgrid,让SendGrid处理我的Azure订阅时遇到了一些大问题。它根本不发送电子邮件!我遵循了教程,代码基本上是从他们那里复制的,但电子邮件不会发送到我的地址。下面的代码用于我的联系方式 我主要关心的是echo$response什么都不给,甚至连一个空格都没有 <?php // use actual sendgrid username and password in this section $url = 'https://api.sendgrid.com/'; $user = 'remov
echo$response
什么都不给,甚至连一个空格都没有
<?php
// use actual sendgrid username and password in this section
$url = 'https://api.sendgrid.com/';
$user = 'removed'; // place SG username here
$pass = 'removed'; // place SG password here
$to = 'removed@removed.com';
// grabs HTML form's post data; if you customize the form.html parameters then you will need to reference their new new names here
$name = $_POST['name'];
$email = $_POST['email'];
$subject = $_POST['subject'];
$message = $_POST['message'];
// note the above parameters now referenced in the 'subject', 'html', and 'text' sections
// make the to email be your own address or where ever you would like the contact form info sent
$params = array(
'api_user' => $user,
'api_key' => $pass,
'to' => $to, // set TO address to have the contact form's email content sent to
'subject' => $subject, // Either give a subject for each submission, or set to $subject
'html' => $message,
'text' => $message,
'from' => $email, // set from address here, it can really be anything
);
//curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
$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);
// Redirect to thank you page upon successful completion, will want to build one if you don't already have one available
//header('url=removed.htm'); // feel free to use whatever title you wish for thank you landing page, but will need to reference that file name in place of the present 'thanks.html'
echo '<script language="javascript">';
echo 'alert("Message Sent.")';
echo '</script>';
echo 'DEBUG: Contact Form works but not fully operational.';
// print everything out
echo $response;
exit();
var_dump(curl_exec($session))的输出是什么代码>?输出为布尔(假)您找到解决方案了吗?