Good to all and to all.
I need expert advice. I am investigating techniques that allow me to be able to collect incoming emails and download the files that have attachments in PHP.
I will have a form in which the user attaches several files. That form will send an email to a company address.
My program should be able to:
- Enter the company email address.
- Have a kind of "listener" that alerts you when there is a new email. Can be done?
- When the new mail arrives, open it and download all the attached files (using a class for example).
In my project I am not using framework and I program the backend in PHP.
Is there an alternative, without using a framework, to be able to carry out the task? Is there an alternative, albeit more complex, using a framework? How do I find out that a new email has arrived in that inbox asynchronously?
I have searched the internet and I know that there are classes that can enter an email address, a tray and get the mails.
Many thanks to all.
Getting the messages is easy, for this we can use the php IMAP extension :
And to extract the attachments here is an excellent code example that will be very easy for you to implement.