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
  • 184,866
  • 48
  • 414
  • 792
Industrial
  • 38,890
  • 68
  • 188
  • 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,560
  • 5
  • 39
  • 73
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
  • 20,680
  • 9
  • 53
  • 64
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,812
  • 1
  • 22
  • 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
  • 4,949
  • 6
  • 25
  • 46