我想使用Email Yak来发送和接收使用PHP的电子邮件。这是不可能的?如果是这样我怎么去呢?
答案 0 :(得分:2)
我不确定您为什么要从PHP中执行此操作,但请查看Email Yak项目中的'Send Email' manual page。
您需要使用PHPs curl extension使用适当的标头和PHP本地json_encode()
function发出HTTP请求,以序列化您要发送的数据。
来自jonasjohn.de的一个非常简单的卷曲示例让你前进:
function curl_download($ url){
// is cURL installed yet? if (!function_exists('curl_init')){ die('Sorry cURL is not installed!'); } // OK cool - then let's create a new cURL resource handle $ch = curl_init(); // Now set some options (most are optional) // Set URL to download curl_setopt($ch, CURLOPT_URL, $Url); // Set a referer curl_setopt($ch, CURLOPT_REFERER, "http://www.example.org/yay.htm"); // User agent curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0"); // Include header in result? (0 = yes, 1 = no) curl_setopt($ch, CURLOPT_HEADER, 0); // Should cURL return or print out the data? (true = return, false =
打印) curl_setopt($ ch,CURLOPT_RETURNTRANSFER,true);
// Timeout in seconds curl_setopt($ch, CURLOPT_TIMEOUT, 10); // Download the given URL, and return output $output = curl_exec($ch); // Close the cURL resource, and free system resources curl_close($ch); return $output;
}
答案 1 :(得分:0)
电子邮件Yak使用GET,POST和JSON。你肯定可以与PHP集成。
有关详细信息,请参阅http://docs.emailyak.com/。