I have a shared hosting account (cPanel, with SSH), and I want to programmatically add e-mail accounts that can receive e-mails and then be checked via POP3. I don't care about webmail, spam protection, outgoing mail, or anything else. I just want to add an account, then put ftp.domain.com as the POP3 server in Outlook/Thunderbird/whatever with the account's username and password and to have it get e-mails sent to user@domain.com.

So, I assume that this is done by system calls. As far as I know, I need to do:

Adduser username -g mail
Passwd username password

Is this all? Should I then be able to send e-mails to username@domain.com and get e-mails in a client? Since it's a shared host, do I somehow need to compensate for that? (Will the e-mails sent to my domain end up at the right users? Are the users created server-wide, or just from my account?) Will this work with the existing daemon?

Thanks in advance.

BTW: Supposedly I could also hack a cPanel call, but this way is cooler. :) And I know that I shouldn't be doing this on a shared account, but I'm just playing around.


In reply to Programmatically Adding E-Mail Accounts by rjahrman

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.