Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Convert Email Messages to other Formats & Manage Attachments in Cloud Using Ruby


  • Please log in to reply
No replies to this topic

#1 johansonkath

johansonkath

    Passenger

  • Members
  • 1 posts

Posted 06 June 2014 - 07:05 AM

You can now convert email message to other formats like EML, MSG & MHT in a cloud using Aspose Cloud SDK in Ruby. Also, developers can download attachments from email messages and store them on a local disc or on Aspose storage. It is even possible to modify email message properties like From, To, and Subject. Below are the code samples for Converting Email to Other Formats and Download Attachment from Email.

 

Converting Email to Other Formats

require 'path/to/lib/asposecloudsdk'
app_sid = '****'
app_key = '****'
Aspose::Cloud::Common::AsposeApp.app_key = app_key
Aspose::Cloud::Common::AsposeApp.app_sid = app_sid
Aspose::Cloud::Common::AsposeApp.output_location = ''
Aspose::Cloud::Common::Product.set_base_product_uri('http://api.aspose.com/v1.1')
# Create Object of folder class
folder = Aspose::Cloud::AsposeStorage::Folder.new
folder.upload_file 'path/to/storage/email_test.eml'
# Create object of converter
con_obj = Aspose::Cloud::Email::Converter.new('path/to/storage/email_test.eml')
con_obj.convert('msg')

Download Attachment from Email

require 'path/to/lib/asposecloudsdk'
app_sid = '****'
app_key = '****'
Aspose::Cloud::Common::AsposeApp.app_key = app_key
Aspose::Cloud::Common::AsposeApp.app_sid = app_sid
Aspose::Cloud::Common::AsposeApp.output_location = ''
Aspose::Cloud::Common::Product.set_base_product_uri('http://api.aspose.com/v1.1')
# Create Object of folder class
folder = Aspose::Cloud::AsposeStorage::Folder.new
folder.upload_file 'path/to/storage/email_test.eml'
# Create object of email document
doc_obj = Aspose::Cloud::Email::Document.new('path/to/storage/email_test.eml')
result = doc_obj.get_attachment('attachment.jpg')





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users