0

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!

hakre
  • 193,403
  • 52
  • 435
  • 836
Industrial
  • 41,400
  • 69
  • 194
  • 289

4 Answers4

2

This answer might help: 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.

Community
  • 1
  • 1
Chuck Burgess
  • 11,600
  • 5
  • 41
  • 74
1

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
  • 21,110
  • 9
  • 55
  • 65
1

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
  • 4,842
  • 1
  • 24
  • 30
0

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
  • 5,169
  • 6
  • 28
  • 47