作者 zhl

自定义邮件和短信

... ... @@ -163,6 +163,62 @@ class FormGlobalsoApi
}
/**
*
* 自定义邮件发送接口
* @param string $to_email 接收邮箱
* @param string $subject 标题
* @param string $message 发送内容
* @param string $ip 发送ip
* @param string $refer 来源页面
* @param string $submit_time 询盘发送时间
* @param string $reply_email 回复邮箱
* @return bool
*/
function customizeInquiryEmail($to_email, $subject, $message, $ip, $refer, $submit_time, $reply_email = '')
{
$post_data['from_email'] = 'mail@goodao.cn';
$post_data['to_email'] = trim($to_email);
$post_data['title'] = trim($subject);
$post_data['message'] = $message;
$post_data['ip'] = trim($ip);
$post_data['refer'] = trim($refer);
$post_data['reply_email'] = trim($reply_email);
if(!$reply_email){
$post_data['reply_email'] = $post_data['from_email'];
}
$post_data['submit_time'] = $submit_time;
$url = "https://form.globalso.com/api/b4153b7556";
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.87 Safari/537.36');
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
$curl_response = curl_exec($curl);
curl_close($curl);
return true;
}
/**
* 推送自定义询盘短信
* @param string $phones 多个手机号码, 使用英文逗号隔开
* @param string $country
* @param string $domain
* @return mixed|string
*/
public function customizeInquirySms($phones, $country, $domain)
{
$param = compact('phones', 'country', 'domain');
$url = 'https://form.globalso.com/api/send_sms?' . http_build_query($param);
$result = http_get($url,['charset=utf-8']);
return $result;
}
/**
* @remark :获取当前项目所有询盘及询盘国家
* @name :getInquiryAll
* @author :lyh
... ...