使用PhP创建电子邮件帐户-我需要解决一些问题 [英] Create an email account with PhP - With some things I need to work around

查看:158
本文介绍了使用PhP创建电子邮件帐户-我需要解决一些问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在PhP中创建一个电子邮件帐户.我在网上发现了大量的代码示例可以执行此操作,但是我有一些问题:

  • 我位于具有默认php.ini的共享服务器主机上,并且我的主机不会更改它
  • 我需要通过URL而不是表单(例如:mywebsite.com/email.php?username=user)创建它
  • 每次创建的密码和配额都必须相同,因此,?之后的唯一内容是?我需要的是用户名

我有0个PhP经验,所以我不能只编辑一个我在网上找到的人,所以很抱歉,这很容易.如果有人可以指出我的意图,那就是有人写的东西或很棒的东西!谢谢.

解决方案

从您的回复中可以看出,您正在使用cPanel.这非常有用,因为cPanel为某些管理任务提供了自己的XML API,包括创建电子邮件帐户.

您可以在此论坛帖子中找到一个使用cPanel XML API并完成您需要做的准备好的脚本:

http://forums.glowhost.com/programming-talk/using-cpanel-api-creating-email-account-forwarders-your-own-php-scripts-2798.html

此SO问题包含有关如何使用cPanel的信息自己使用XML API.

如果由于某种原因而无法使XML API正常工作,则还有另一个脚本可以在此处对cPanel本身进行常规的HTTP调用:

http://www.zubrag.com/scripts/cpanel -create-email-account.php

I need to create an email account in PhP. I found a ton of code samples online that do this, however I have a few problems:

  • I'm on a shared server host with the default php.ini, and my host won't change it
  • I need to create it via a URL, not with forms (something like: mywebsite.com/email.php?username=user)
  • The password and quota created needs to be the same every time, so the only thing after the ? I need is the username

I have 0 experience with PhP so I can't just edit one I find online, so sorry if this is easy. If someone could point me in the direction of a script someone made or something that'd be great! Thanks.

解决方案

From your reply, it turns out that you are using cPanel. This is quite helpful, as cPanel provides its own XML API for some administrative tasks, including creating email accounts.

You can find a ready made script that uses the cPanel XML API and does what you require in this forum post:

http://forums.glowhost.com/programming-talk/using-cpanel-api-creating-email-account-forwarders-your-own-php-scripts-2798.html

This SO question contains information on how to use the cPanel XML API yourself.

If for some reason you can't get the XML API to work, there's another script that makes regular HTTP calls to cPanel itself over here:

http://www.zubrag.com/scripts/cpanel-create-email-account.php

这篇关于使用PhP创建电子邮件帐户-我需要解决一些问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆