I need to write a mail client in PHP. It must contain two tabs, "Inbox" and "Sent". I understand how to implement the "Sent" functionality through the mail() function.

Correctly, I realized that it would be necessary to keep copies of letters in the database, and then output them?

But how to implement the Inbox functionality? I do not quite understand. Need your help.

  • At the seed of php-zametki.ru/php-nachinayushhim/… - Mikhail Alekseevich
  • one
    The pop3 that you are offered above for such purposes is poorly suitable for it will force you to keep copies of all letters in the database and display the status from there. It is better to use the IMAP protocol if the mail server supports it. It allows you to store everything directly on the mail server, search by different criteria, etc. and you can safely store nothing in your php script anywhere at all, always getting it straight from the imap server - Mike
  • @Mike pop3 does not always oblige to delete letters from the server :) - Mikhail Alekseevich
  • @Mike Can I contact you somehow? Pts need help. - Alexander Salychev
  • @ MikhailAlekseevich Delete is not required. But besides the deletion, there are such things as "viewed" status - Mike

1 answer 1

Your mail server, or the side of Yandex / Google? Considering that in PHP, the client will also be on a server that is constantly online?

Do not store mail in the database, even if it is on the server.

Do not send mail with the mail () function, you will first have to create a letter according to all RFCs, this is not at all easy, so stop writing bicycles, use the PHPmailer or SwiftMailer libraries. According to the descriptions, I liked the second one more, but it has a strange validator, it does not allow outgoing mail to a four-letter domain zone (.info .club, .name, etc.), or I just could not force it to do it.

Use IMAP functions to work with letters in folders (view-delete, etc.)