Question

I get emails to my website address from a particular email address who attach an xml doc. What's the easiest way to access the attachment so that I can scrape the data from the xml file whenever I get an email from this particular source?

Once I open the attachment I can scrape any info I need and update my database, I'm just not sure how to go about accessing the emails and opening the attachments.

Was it helpful?

Solution

If you use IMAP you can use PHP's built-in imap functions. This way, you can access the contents of the email.

Check this site for a tutorial http://davidwalsh.name/gmail-php-imap (It will work on any IMAP account, not just Gmail).

This will help you get up to speed. Then, when you know the basics, follow this tutorial to learn how you can access the attachments through PHP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top