tags:

views:

62

answers:

2

Hi all,

Visitors can contact staff by means of contact form (visitor needs to submit email as well). This will be stored in DB. Now considering that staff responds to this message, the reply from the staff would be sent to the visitors email directly. Say if the user wants to follow up on the message sent by the staff, I would like the visitor to just hit the reply button in his email service & send me his questions on the same topic, but just retain the ID in the Subject line. So when the visitor send this email, I would like to receive the email & at the same time, try to search in my DB if the ID that is present in the email subject, actually exists in the system. If yes, that would be sent back to the same staff member who handled the response previously or it would be assigned to a new staff member.

That being said, I was thinking of how to do this. The part where I am really held up is when the staff receives the actual email from the visitors email, how can I check the DB? Say I am/staff is receiving emails at [email protected]. When visitor sends reply email, then it would be sent to [email protected]. How can I check to see if the ID in the subject line of the email that I received at [email protected], actually exists in my DB in my website? This is where I am really stuck.

Looking forward for your replies. Thank you.

A: 

There are several approaches that you can use for automatically processing email. Which one you choose is going to depend upon your specific needs:

  1. Configure your MTA (mail server) to run a program when it receives mail at a given address (eg: [email protected]). The mail message itself will be passed to the program to handle. This works if you have your own mail server, and is the most responsive solution, but can be quite complex to configure and will usually require restarting the mail server to change.

  2. Write a program that periodically scans a mailbox (either with POP or IMAP) and then processes each new message. This works better for situations where you don't control your own mail server (eg: you're using Gmail or Yahoo mail) and is more flexible to configure.

  3. Write an extension for your MUA (mail client eg MS Outlook, Thunderbird, etc.) This requires that everyone who could receive a message be running the same client software, and it depends upon the APIs that your client provides for extensions. This won't work with web-only interfaces, but will allow you to process a message interactively and to interact with the user.

I tend to favor the first approach, though I have used the second approach as well.

Craig Trader
Devner
For options 2 you did need to learn a programming language if you dont already know one or use a ticket system that is alreay built and available out there such as perldesk... for instance with php http://php.net/manual/en/book.imap.php or with perl http://perldoc.perl.org/Net/POP3.html
Prix
Devner
First thing you have to do is to verify if your php has imap within it, you can try using sockets for pop3 too if u dont have imap available, af for imap it has to be compiled as an option, but most hosts have it you can check that using the <?php info(); ?> which will show what your php has installed, etc... Then if you have imap which is probably the best option check this http://www.php.net/manual/en/function.imap-open.php if dont you can try with sockets, a sample http://www.adamsinfo.com/a-rudimentary-php-pop3-example/ but i am sure someone with better knowledge will cover this.
Prix
Prix
Thank you so much for the pointers. I will try that.
Devner
+1  A: 

Have a look at this zend library, it is nice and easy to incoporate into your site and means you dont have to try and write some hard code to read a message box etc

Hope it helps

Luke

Luke
Devner
Devner
@Denver, just in case you didn't realise, you can use the mail library without using the zend framework, you can even use a different framework such as symfony and include zend library's. I know it means you have to trust or read the zend library but also is it worth re-inventing the wheel?
Luke
@Luke, thanks for informing me about that. I will take a look at it.
Devner