2

I don't want to use shell script to read mail on the server. I try to use PHP script to read that mail. Is it possible? If it's possible, how can I start to do?

I know a little about shell script.

please give me the link or code to start with.

Kannika
  • 2,538
  • 2
  • 27
  • 38
  • What do you mean by "read mail"? Why not use alpine or mutt? – Rafe Kettler Nov 03 '11 at 05:04
  • Normally, We can send an email by using php. but this time i want to read the email that sent by using php too. because i want to do something with that email. – Kannika Nov 03 '11 at 06:50

3 Answers3

1

Yes you can do it in PHP. It depends on which way u need it. This link explains creation of mail client in PHP http://www.devshed.com/c/a/PHP/Building-A-PHPBased-Mail-Client-part-1/

Kris
  • 8,680
  • 4
  • 39
  • 67
  • I want to get the attachment file from that mail. – Kannika Nov 04 '11 at 03:35
  • I think this question has an answer.. http://stackoverflow.com/questions/114953/how-to-get-email-and-their-attachments-from-php – Kris Nov 04 '11 at 04:54
  • Consider this also http://stackoverflow.com/questions/7345479/how-to-save-the-attachments-of-a-email-in-php – Kris Nov 04 '11 at 04:56
0

At some point I wanted to check if there was any unread messages in a couple mailboxes from inside an website administration panel, so I ended up with a simple script like the one described here. What we want is to fetch the all the messages in the INBOX of each e-mail account for the past week, using the IMAP functions of PHP. Also, we are going to mark the unread messages with a different style.

http://www.backslash.gr/content/blog/webdevelopment/8-check-your-email-with-php-and-imap

Dharmesh Hadiyal
  • 719
  • 1
  • 7
  • 18
0

I also wrote a blog post on this subject a while back. Sometimes using pop or imap might not be desirable, my blog was for Rails but the different options and principals still all apply.

The post shows a number of methods including polling, piping directly into your app when a message is received, using curl and third party solutions that don't require you're own mail server.

Steve Smith
  • 5,146
  • 1
  • 30
  • 31