1

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.

Minicl55
  • 947
  • 5
  • 14
  • 21
  • You need to provide more info... what is your server's operating system? Are you using a hosting panel to manage your domain, like cPanel or Plesk? Which mail server software are you using? For *nix systems, there's sendmail (among others), which has a lot of replacements like postfix and qmail – Filippos Karapetis Jun 08 '13 at 06:52
  • @FilipposKarapetis I don't know the OS, however it's a cPanel system, and I'm just using the generic cPanel webmail system. – Minicl55 Jun 08 '13 at 17:12

1 Answers1

1

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

Community
  • 1
  • 1
Filippos Karapetis
  • 4,367
  • 21
  • 39