我使用sendgrid很长一段时间,它工作正常。但是从昨天开始发送超过10000个字符的电子邮件,然后开始发送电子邮件的部分是在电子邮件的最后添加,但是不到10K字符,它绝对没问题。
我测试了我的源代码非常好,即使我之前说过它工作正常。我使用php mail()方法测试,并且使用mail()方法
工作正常这是我的sendgrid api代码。
$from = "bp@xxxxxxxx.com.au";
$headers = 'From: <'.$from.'>' . "\r\n";
$url = 'https://api.sendgrid.com/';
$user = 'xxxxxxxxx';
$pass = 'xxxxxxxxxx';
$ToEmailArray = explode(",",$toEmail);
$json_string = array('to' => $ToEmailArray);
$params = array(
'api_user' => $user,
'api_key' => $pass,
'x-smtpapi' => json_encode($json_string),
'to' => '',
'subject' => $subject,
'html' =>$message,
'from' => $from
);
$request = $url.'api/mail.send.json';
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS, $params);
// Tell curl not to return headers, but do return the response
curl_setopt($session, CURLOPT_HEADER, false);
// Tell PHP not to use SSLv3 (instead opting for TLS)
curl_setopt($session, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
// blinding the CV https certificates
curl_setopt($session, CURLOPT_SSL_VERIFYPEER, false);
// obtain response
$response = curl_exec($session);
//$contents['response'] = $response;
curl_close($session);
我也谈到了sendgrid的客户支持,但他们说他们的API没有任何问题。
有人可以帮助我。
感谢。