Results 1 to 2 of 2

Thread: Php mail server

  1. #1
    Join Date
    Aug 2009
    Posts
    74
    Thanks
    7
    Thanked 1 Time in 1 Post

    Default Php mail server

    Hi,

    I want to create a mail server in php.
    can you please suggest me any open source mail servers in php.
    which should support these protocols
    IMAP, POP, SMTP, WebDav (exchange)


    I want to know if it can be done in PHP or not

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Try looking on google. This is a very complex topic and honestly only a few users here would know where to start with that (much less how to complete it).


    Most hosts have mail servers built in and in fact you must have a mail server in order to use mail() in PHP-- I believe it comes bundled and installs by default. There should be plenty of information (at php.net, google search) if you didn't install it with PHP, though. This built in mail server I believe only supports sending emails, though, or at least it is only configured to do so.


    As for receiving messages, that makes things much more complex. The problem with PHP is that it doesn't run without being requested. So PHP won't do anything until someone visits a page. One way around this is to use cron jobs (scripts set to automatically run at certain times), but this can be hard to setup and with email it would have to run a lot and even then might not be too reliable.

    To allow the various protocols, you would be doing something very low level, something generally beyond PHP. It's not impossible to use PHP for this (PHP can do basically anything) but the way it is generally configured to run isn't very compatible. It's meant to generate text [html, etc] upon a user request. It can do other stuff too, like connect to a database, but this still remains within the general sense of 'dynamically created webpage' and not 'full [mail] server'.


    Why not just install a real mail server on the server? That'll save you a lot of time. It's probably also possible to then access that using PHP if needed, such as to allow a web-mail option for users. (I'm guessing here, but it seems like whatever method used for storing messages on the server-- database? flat files?-- would be accessible to PHP, right?)


    So here's the best answer I have:
    The default with PHP is mail() and the mail server behind this only(?) does outgoing messages.
    There's also another set of functions called imap():
    http://www.php.net/manual/en/book.imap.php
    This appears to have everything you'd need to interact with a full working mail server. But that means you need the mail server installed. I believe the mail server is not necessarily included with php by default.
    The info on that page should get you started.
    http://www.php.net/manual/en/imap.requirements.php
    It looks like the mail server is built in C and it's called 'imap' also.

    I think this is what you're looking for, unless you literally want to program a mail server in PHP (in which case I wish you luck ).
    Last edited by djr33; 06-02-2010 at 09:24 AM.
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •