" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi

Downloading Attachments From Mails Through IMAP in Rails

Posted on November 23rd, 2015 by Shatabdi Mohapatra

Sometimes there is a requirement to download the attachments of mails being accessed thorugh IMAP protocol in Rails. 1. Firstly, we need to connect to imap and login to the mail account of the user. def get_messages require ‘net/imap’ require ‘mail’ imap = Net::IMAP.new(params[:host], params[:port], params[:ssl]) imap.login(params[:username], params[:password]) 2. Then we need to select the […]