作者 zhl

自定义邮件和短信

@@ -163,6 +163,62 @@ class FormGlobalsoApi @@ -163,6 +163,62 @@ class FormGlobalsoApi
163 } 163 }
164 164
165 /** 165 /**
  166 + *
  167 + * 自定义邮件发送接口
  168 + * @param string $to_email 接收邮箱
  169 + * @param string $subject 标题
  170 + * @param string $message 发送内容
  171 + * @param string $ip 发送ip
  172 + * @param string $refer 来源页面
  173 + * @param string $submit_time 询盘发送时间
  174 + * @param string $reply_email 回复邮箱
  175 + * @return bool
  176 + */
  177 + function customizeInquiryEmail($to_email, $subject, $message, $ip, $refer, $submit_time, $reply_email = '')
  178 + {
  179 + $post_data['from_email'] = 'mail@goodao.cn';
  180 + $post_data['to_email'] = trim($to_email);
  181 + $post_data['title'] = trim($subject);
  182 + $post_data['message'] = $message;
  183 + $post_data['ip'] = trim($ip);
  184 + $post_data['refer'] = trim($refer);
  185 + $post_data['reply_email'] = trim($reply_email);
  186 + if(!$reply_email){
  187 + $post_data['reply_email'] = $post_data['from_email'];
  188 + }
  189 + $post_data['submit_time'] = $submit_time;
  190 + $url = "https://form.globalso.com/api/b4153b7556";
  191 + $curl = curl_init($url);
  192 + curl_setopt($curl, CURLOPT_POST, 1);
  193 + curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  194 + curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 30);
  195 + curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
  196 + curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
  197 + 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');
  198 + curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
  199 + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
  200 + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
  201 + $curl_response = curl_exec($curl);
  202 + curl_close($curl);
  203 + return true;
  204 + }
  205 +
  206 + /**
  207 + * 推送自定义询盘短信
  208 + * @param string $phones 多个手机号码, 使用英文逗号隔开
  209 + * @param string $country
  210 + * @param string $domain
  211 + * @return mixed|string
  212 + */
  213 + public function customizeInquirySms($phones, $country, $domain)
  214 + {
  215 + $param = compact('phones', 'country', 'domain');
  216 + $url = 'https://form.globalso.com/api/send_sms?' . http_build_query($param);
  217 + $result = http_get($url,['charset=utf-8']);
  218 + return $result;
  219 + }
  220 +
  221 + /**
166 * @remark :获取当前项目所有询盘及询盘国家 222 * @remark :获取当前项目所有询盘及询盘国家
167 * @name :getInquiryAll 223 * @name :getInquiryAll
168 * @author :lyh 224 * @author :lyh