Jump to content

PHP Mail Server


S Murder

Recommended Posts

Would it be possible to write some PHP code that will accept incoming SMTP messages and store email in a database based on the username of the recipient?Basically, I want one PHP script to dynamically accept a mail message if the recipient username exists in my database.Alternatively, could I configure a single email account to accept all mail, and then use PHP to remove the mail and store it in a database based on the recipient?

Link to comment
Share on other sites

Hi.. Its possible but for that you have to go through IMAP protocol instead of SMTP. With the help of that you can generate MailBox and perform all actions.. You can see the IMAP functions in PHP manuals..Regards,Vijay

Link to comment
Share on other sites

Hi.. Its possible but for that you have to go through IMAP protocol instead of SMTP. With the help of that you can generate MailBox and perform all actions.. You can see the IMAP functions in PHP manuals..Regards,Vijay
I checked here: http://us2.php.net/imapIt looks like it will let me connect to a mail box, allowing the second method I proposed, but is there a way to make a PHP script that will accept an incoming email?
Link to comment
Share on other sites

In order to accept an incoming email a program needs to actively listen on port 25, so it needs to open port 25 and listen on it. If there is already something listening on port 25 then obviously another program would not be able to use it. There are several ways to write email clients, and PHP is not the best tool to use to do it. For one, it requires a running program that is maintaining a listening state, most PHP scripts run once and then stop, they don't continue running. The PHP engine even has a max execution time configured to specifically stop a script that runs for a certain amount of time.PHP is a great language, but it's not the end-all-be-all of programming. If you want to write a mail server use C.

Link to comment
Share on other sites

I know PHP isn't best for this, it's just that I have this cheapo hosting at the moment that allows PHP but not custom services/programs.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...