views:

45

answers:

5

Hi everybody,

I have thought some time about creating a PHP-based customer-service thingy that assigns different types of customer-related stuff to a ticket-id (#).

For starters, I would like to be able read emails from an email account and assign a ticket-id to every new email that's received.

I have no bloody idea of how I could make PHP read from a email account, or to do whatever that is needed to make this happen, so if anyone here could nudge me in the right direction - it would be fantastic!

Thanks a lot!

A: 

First google result for: php mail client

http://www.devshed.com/c/a/PHP/Building-A-PHPBased-Mail-Client-part-1/

Fosco
A: 

Give this a try pop3 mail class

I used it some time ago , and it worked, but you have to make some mime parsing, so start looking at this and you will get the ideea

Centurion
+1  A: 

You could get a PHP based mail client, or you could look into scraping. Google php email client or check out

http://www.oooff.com/php-scripts/basic-curl-scraping-php/basic-scraping-with-curl

Robert
+1  A: 

This answer might help: http://stackoverflow.com/questions/114953/how-to-get-email-and-their-attachments-from-php

This will allow each incoming email to process as it comes in without requiring setting up a cron to process them.

cdburgess
A: 

The Zend_Mail_Storage_* components from Zend Framework provide reading mail.
Supported storage types are:

  • local
    • Mbox
    • Maildir
  • remote
    • Pop3
    • IMAP

They provide a convenient and clean api.

// connecting with Imap
$mail = new Zend_Mail_Storage_Imap(array(
    'host'     => 'example.com',
    'user'     => 'test',
    'password' => 'test'
));

$maxMessage = $mail->countMessages();

foreach ($mail as $messageNum => $message) {
    // output subject of message
    echo $message->subject . "\n";

   // output message content for HTML
   echo '<pre>';
   echo $message->getContent();
   echo '</pre>';    
}
Benjamin Cremer