收到后,Sendgrid电子邮件附件将受法院保护

问题描述

这是Sendgrid电子邮件发送代码

$url = 'https://api.sendgrid.com/';
$user = 'USER';
$pass = 'PASS^5s';
$fileName = 'qr.png';
$filePath =  dirname(__FILE__); //base_url('assets/avator');
$emaillist_act=array("test@gmail.com");
$json_string = array( 'to' =>$emaillist_act,'category' => 'signup-form');
// echo $filePath.'/'.$fileName; die;
$params = array(
    'api_user'  => $user,'api_key'   => $pass,'x-smtpapi' => json_encode($json_string),'to'        => "test@gmail.com",'subject'   => "TEST PDFs",'html'      => "This is a test",'fromname' => 'COMPANY','from'      => "COMPANY<info@COMPANY.com>",'files['.$fileName.']' => '@'.$filePath.'/'.$fileName
  );
print_r($params);
$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);
// 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);
// obtain response
$response = curl_exec($session);
curl_close($session);
// print everything out
print_r($response);
      }

发生的情况是它发送了附件,但是我收到的文件被求助,并且在出现图像无效的情况下无法打开。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)