Drongo_III Posted April 20, 2012 Share Posted April 20, 2012 Hi Guys I'm just looking for some advice to make sure i go in the right direction from the off! Building a new system for a client. They'll receive contact information from a contact form on their website and the details of the contact form are logged in the admin area of the cms. The client wants to be able to respond to these contacts via email without logging into the system and then have the details of the reply logged in the admin area of the cms to know when something has been responded to. So essentially i need some way of getting that email into the database. The only way i can see this happening is to setup a new mailbox, the client blind copies that mailbox address into all replies, a cron then runs a php script that picks up most recent emails via imap and then reads in the data - thereby registering the fact a response has happened (probably from the subject line reference) and it would then update the status of the contact. I am assuming this is theoretically possible as i've never done anything like that before. So... 1) Is there a better way of doing this without having the client login to the site to respond? 2) Does the proposal above sound reasonable? Any advice would be much appreciated... Drongo Quote Link to comment Share on other sites More sharing options...
Drongo_III Posted April 20, 2012 Author Share Posted April 20, 2012 can anyone offer some advice on if i'm doing this right? Quote Link to comment Share on other sites More sharing options...
Barand Posted April 21, 2012 Share Posted April 21, 2012 You can use IMAP functions to read mail. eg <?php if (!extension_loaded('imap')) { dl('php_imap.dll'); } /* conneciont to mail */ $hostname = "{servername:110/pop3}INBOX"; $username = 'domain\\mailboxusername'; $password = 'password'; /* try to connect */ $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to server: ' . imap_last_error()); $startdate = date('d M Y', strtotime($_GET['date'])); $nowdate = date ('d M Y'); /* grab emails */ $emails = imap_search($inbox, "ALL SINCE \"$startdate\" BEFORE \"$nowdate\""); ?> Quote Link to comment Share on other sites More sharing options...
Drongo_III Posted April 22, 2012 Author Share Posted April 22, 2012 Hi Barand Thanks for that. I thought imap might be the way to go but wanted to make sure i wasn't missing some simpler solution. You can use IMAP functions to read mail. eg <?php if (!extension_loaded('imap')) { dl('php_imap.dll'); } /* conneciont to mail */ $hostname = "{servername:110/pop3}INBOX"; $username = 'domain\\mailboxusername'; $password = 'password'; /* try to connect */ $inbox = imap_open($hostname,$username,$password) or die('Cannot connect to server: ' . imap_last_error()); $startdate = date('d M Y', strtotime($_GET['date'])); $nowdate = date ('d M Y'); /* grab emails */ $emails = imap_search($inbox, "ALL SINCE \"$startdate\" BEFORE \"$nowdate\""); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.