我试图制作类似于twitpic.com的电子邮件提交功能。
他们的地址架构类似于username.key@twitpic.com。当您向该地址发送电子邮件时,它会对其进行处理并上传您的照片。
我想知道他们是如何在php中生成和处理这些地址的。我知道如何使用cpanel将单个电子邮件地址传递给程序,但这是如何动态完成的?
我会解决这个甚至被称为或一些谷歌搜索结果,所以我可以做自己的研究,但我只想要一个地方开始。
答案 0 :(得分:2)
cpanel中有一个选项可以设置一个默认地址,用于捕获发送到不存在的地址的所有电子邮件。这可能是最简单的方法。
事实上,在我所拥有的cpanel版本中,如果你转到默认地址,然后转到高级选项,可以选择将没有有效地址的所有邮件传递给程序。
答案 1 :(得分:1)
好的,我发现了这个
http://twiki.cpanel.net/twiki/bin/view/AllDocumentation/AutomationIntegration/Api2AddForwarder
试图找出如何/在哪里使用PHP
<强>更新强>
在这里找到了一个cpanel api类
http://www.phpclasses.org/browse/file/17045.html
我试图联系该类的作者,看看如何将api的功能添加到该类(它已经可以处理转发器的创建)
答案 2 :(得分:0)
在代码下面复制和替换并替换所需的变量,它将起作用:
/*Host Credentials*/
$host = "Host Name";
$port = "Port Number ex. 2083";
$HostUserName = "Your cpanel username";
$HostPassword = "Your cpanel password";
/*-------------------------*/
/*Email details which you want to create*/
$email = "email name which you want to create";
$domain = "Domain name on which you want to create the email for subdomain you can write ex. subdomain.domain.com";
$password = "Password for your email"
$quota = "limit which you want to assign for this account."
/*--------------------*/
$query = 'https://'.$host.':'.$port.'/frontend/x3/mail/doaddpop.html?email='.$email.'&domain='.$domain.'&password='.$password.'"a='.$quota;
$curl = curl_init(); // Create Curl Object
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); // Allow self-signed certs
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); // Allow certs that do not match the hostname
curl_setopt($curl, CURLOPT_HEADER, 0); // Do not include header in output
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // Return contents of transfer on curl_exec
$header[0] ="Authorization: Basic " . base64_encode($HostUserName.":".$HostPassword) . "\n\r";
curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // set the username and password
curl_setopt($curl, CURLOPT_URL, $query); // execute the query
$result = curl_exec($curl);
curl_close($curl);