recieve mail with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Howard547
Forum Newbie
Posts: 13
Joined: Fri Jul 19, 2002 11:58 am

recieve mail with php

Post by Howard547 »

Lets say i sent up an email adress "johndoe@domain.com." Whenever someone sends an email to "johndoe@domain.com" the message is sent to a php script where it then parses, and puts relevant information into a database.

A real life example of this is with DeskPro. You can post tickets to your account by emailing a support email account.

Does anybody know how to do this?
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

you will have to deal with Socket Programming, as this is not a simple task to do, you'll have to understand how to talk to a POP3 or IMAP server
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

fortunately php knows how to deal with imap/pop3 servers ;-)
http://php.net/imap
But the script will not automagically be invoked when an email arrives. You have to take care of that yourself (e.g. by polling)
Cruzado_Mainfrm
Forum Contributor
Posts: 346
Joined: Sun Jun 15, 2003 11:22 pm
Location: Miami, FL

Post by Cruzado_Mainfrm »

lol i think i skipped that part when reading the php manual :D my bad
by the way, you can check for e-mails by setting cronjobs (only in unix)
evilMind
Forum Contributor
Posts: 145
Joined: Fri Sep 19, 2003 10:09 am
Location: Earth

Post by evilMind »

Just be careful if you are using software like vpopmail or anything that will allow virtual domains. Sometimes imap/pop3 doesn't like to connect unless you use "{foo.bar.com:143/imap/notls)" as the mailbox string.
Post Reply