Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Working with Email file formats using Aspose.Email

asposeforcloud edited this page · 2 revisions
Clone this wiki locally

In order to work with email formats using Aspose Cloud SDK for Ruby, please read below articles for more information. Please note that these articles are based on revamped branch.

Converting Email to Other Formats

  • Set the base product URI, App SID, App Key and output location.
  • Upload the input email file.
  • Create an object of the Converter class and call the convert method.

Following is the complete code.

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

  • Set the base product URI, App SID, App Key and output location.
  • Upload the input email file.
  • Create an object of the Document class and call the getAttachment method.

Following is the complete code.

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')

Retrieve Email Message Properties

  • Set the base product URI, App SID, App Key and output location.
  • Upload the input email file.
  • Create an object of the Document class and call the getProperty method.

Following is the complete code.

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_property('Subject')

Change Email Message Properties

  • Set the base product URI, App SID, App Key and output location.
  • Upload the input email file.
  • Create an object of the Document class and call the setProperty method.

Following is the complete code.

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.set_property('Subject','New Subject of Email Document')
Something went wrong with that request. Please try again.