Tags

This is the process used to import a csv that was sent to a gmail address using feeds and mailhandler. Everything is on Drupal 7

This is a rough approximation of what I did. Some things need some polishing e.g. I set it up to import even if it isn't authorized on the file import. I need to secure that.

  1. Install PHP IMAP library (On your server)
  2. First install Mailhandler
  3. Install Feeds
  4. Install Attachment Links

 

  1. Create the Gmail account you will be importing from.
  2. Enable POP in Gmail ( I Also set it to archive messages once they were downloaded to prevent multiple imports.

 

  1. Enable the modules you installed on the site.
  2. Create the content type you are trying to import. 
  3. Create a file holder content type to hold the csv you are importing from. On the content type edit page there is a new vertical tab for attachment links, enable it for the file field. I set it hold one fiel and used the file widget.

 

  1. Structure > Mailhandler Mailboxes
  2. + Add
  3. There is a bug currenlty when it tries to use ajax to test the settings. Fill out the domain and password last, you may have to save it and come back in a couple times. Before clicking save always click elsewhere on the page to initiate the ajax call and wait for it to complete or it won't save the settings.
  4. For Gmail use pop as the protocol
  5. Domain should be pop.gmail.com
  6. port should be 995
  7. Username is full email
  8. Pass is stored in plaintext so use a throwaway account if possible
  9. Extra commands must be /ssl/novalidate-cert

 

  1. Create a feeds importer for grabbing the file.
  2. Settings Standalone Form 
  3. Every day
  4. Fetcher
  5. Mailhandler fetcher
  6. Settings
  7. All
  8. Parser
  9. Mailhandler IMAP stream parser
  10. Settings
  11. Default
  12. Processor
  13. Node processor
  14. Settings
  15. Bundle > Content type to hold the file
  16. Update existing nodes
  17. User for importing
  18. Authorize
  19. Expire Never
  20. Mapping
  21. Reply-to > title used as unique
  22. attachments > file field

 

  1. Feeds import form for file importer
  2. Choose the mailbox you set up previously
  3. Uncheck the Skip messages that fail authentication
  4. Import

 

  1. Create importer to process the csv
  2. Use typical settings and mappigs to suit your needs
  3. Use the http fetcher
  4. Use the CSV parser

 

  1. Visit the node created by the file field generator and grab the newest file link [nid/attachments/newest]
  2. Go to the http importer
  3. Put the url from above in the url and import