Email Email document (*.eml) operations.
AsFile
Converts Email model to a specified format and returns as a file.
Returns a File . Requires:
request
Email model and format to convert. Type: EmailAsFileRequest .
C#
Copy var request = new EmailAsFileRequest
{
Value = new EmailDto
{
Attachments = new List < Attachment >
{
new Attachment
{
Name = "some-file.txt" ,
Base64Data = "U29tZSBmaWxlIGNvbnRlbnQ="
}
},
Body = "Some body" ,
BodyType = "Html" ,
DeliveryNotificationOptions = new List < EmailDeliveryNotificationOptions >
{
"OnSuccess" ,
"Delay"
},
From = new MailAddress
{
DisplayName = "From Address" ,
Address = "from@aspose.com"
},
HtmlBody = "<b>Some body</b>" ,
IsBodyHtml = true ,
IsDraft = true ,
Subject = "Re: Some subject" ,
To = new List < MailAddress >
{
new MailAddress
{
DisplayName = "To Address" ,
Address = "to@aspose.com"
}
}
}
};
Java
Copy EmailAsFileRequest request = Models . emailAsFileRequest ()
. value ( Models . emailDto ()
. attachments ( Arrays .< Attachment > asList (
Models . attachment ()
. name ( "some-file.txt" )
. base64Data ( "U29tZSBmaWxlIGNvbnRlbnQ=" )
. build ()))
. body ( "Some body" )
. bodyType ( "Html" )
. deliveryNotificationOptions ( Arrays .< EmailDeliveryNotificationOptions > asList (
"OnSuccess" ,
"Delay" ))
. from ( Models . mailAddress ()
. displayName ( "From Address" )
. address ( "from@aspose.com" )
. build ())
. htmlBody ( "<b>Some body</b>" )
. isBodyHtml ( true )
. isDraft ( true )
. subject ( "Re: Some subject" )
. to ( Arrays .< MailAddress > asList (
Models . mailAddress ()
. displayName ( "To Address" )
. address ( "to@aspose.com" )
. build ()))
. build ())
. build ();
Python
Copy request = models . EmailAsFileRequest (
value = models . EmailDto (
attachments = [
models . Attachment (
name = 'some-file.txt' ,
base64_data = 'U29tZSBmaWxlIGNvbnRlbnQ=' )],
body = 'Some body' ,
body_type = 'Html' ,
delivery_notification_options = [
'OnSuccess' ,
'Delay' ],
_from = models . MailAddress (
display_name = 'From Address' ,
address = 'from@aspose.com' ),
html_body = '<b>Some body</b>' ,
is_body_html = True ,
is_draft = True ,
subject = 'Re: Some subject' ,
to = [
models . MailAddress (
display_name = 'To Address' ,
address = 'to@aspose.com' )]))
Ruby
Copy request = EmailAsFileRequest . new (
value : EmailDto . new (
attachments : [
Attachment . new (
name : 'some-file.txt' ,
base64_data : 'U29tZSBmaWxlIGNvbnRlbnQ=' ) ] ,
body : 'Some body' ,
body_type : 'Html' ,
delivery_notification_options : [
'OnSuccess' ,
'Delay' ] ,
from : MailAddress . new (
display_name : 'From Address' ,
address : 'from@aspose.com' ),
html_body : '<b>Some body</b>' ,
is_body_html : true ,
is_draft : true ,
subject : 'Re: Some subject' ,
to : [
MailAddress . new (
display_name : 'To Address' ,
address : 'to@aspose.com' ) ] ))
Typescript
Copy let request = Models . emailAsFileRequest ()
. value ( Models . emailDto ()
. attachments ([
Models . attachment ()
. name ( 'some-file.txt' )
. base64Data ( 'U29tZSBmaWxlIGNvbnRlbnQ=' )
. build ()])
. body ( 'Some body' )
. bodyType ( 'Html' )
. deliveryNotificationOptions ([
'OnSuccess' ,
'Delay' ])
. from ( Models . mailAddress ()
. displayName ( 'From Address' )
. address ( 'from@aspose.com' )
. build ())
. htmlBody ( '<b>Some body</b>' )
. isBodyHtml ( true )
. isDraft ( true )
. subject ( 'Re: Some subject' )
. to ([
Models . mailAddress ()
. displayName ( 'To Address' )
. address ( 'to@aspose.com' )
. build ()])
. build ())
. build ();
PHP
Copy $request = Models :: emailAsFileRequest ()
-> value ( Models :: emailDto ()
-> attachments ( array (
Models :: attachment ()
-> name ( 'some-file.txt' )
-> base64Data ( 'U29tZSBmaWxlIGNvbnRlbnQ=' )
-> build ()))
-> body ( 'Some body' )
-> bodyType ( 'Html' )
-> deliveryNotificationOptions ( array (
'OnSuccess' ,
'Delay' ))
-> from ( Models :: mailAddress ()
-> displayName ( 'From Address' )
-> address ( 'from@aspose.com' )
-> build ())
-> htmlBody ( '<b>Some body</b>' )
-> isBodyHtml ( true )
-> isDraft ( true )
-> subject ( 'Re: Some subject' )
-> to ( array (
Models :: mailAddress ()
-> displayName ( 'To Address' )
-> address ( 'to@aspose.com' )
-> build ()))
-> build ())
-> build ();
AsMapi
Converts EmailDto to MapiMessageDto.
Returns MapiMessageDto model. Requires:
emailDto
Email model to convert. Type: EmailDto .
C#
Copy var emailDto = new EmailDto
{
Attachments = new List < Attachment >
{
new Attachment
{
Name = "some-file.txt" ,
Base64Data = "U29tZSBmaWxlIGNvbnRlbnQ="
}
},
Body = "Some body" ,
BodyType = "Html" ,
DeliveryNotificationOptions = new List < EmailDeliveryNotificationOptions >
{
"OnSuccess" ,
"Delay"
},
From = new MailAddress
{
DisplayName = "From Address" ,
Address = "from@aspose.com"
},
HtmlBody = "<b>Some body</b>" ,
IsBodyHtml = true ,
IsDraft = true ,
Subject = "Re: Some subject" ,
To = new List < MailAddress >
{
new MailAddress
{
DisplayName = "To Address" ,
Address = "to@aspose.com"
}
}
};
Java
Copy EmailDto emailDto = Models . emailDto ()
. attachments ( Arrays .< Attachment > asList (
Models . attachment ()
. name ( "some-file.txt" )
. base64Data ( "U29tZSBmaWxlIGNvbnRlbnQ=" )
. build ()))
. body ( "Some body" )
. bodyType ( "Html" )
. deliveryNotificationOptions ( Arrays .< EmailDeliveryNotificationOptions > asList (
"OnSuccess" ,
"Delay" ))
. from ( Models . mailAddress ()
. displayName ( "From Address" )
. address ( "from@aspose.com" )
. build ())
. htmlBody ( "<b>Some body</b>" )
. isBodyHtml ( true )
. isDraft ( true )
. subject ( "Re: Some subject" )
. to ( Arrays .< MailAddress > asList (
Models . mailAddress ()
. displayName ( "To Address" )
. address ( "to@aspose.com" )
. build ()))
. build ();
Python
Copy email_dto = models . EmailDto (
attachments = [
models . Attachment (
name = 'some-file.txt' ,
base64_data = 'U29tZSBmaWxlIGNvbnRlbnQ=' )],
body = 'Some body' ,
body_type = 'Html' ,
delivery_notification_options = [
'OnSuccess' ,
'Delay' ],
_from = models . MailAddress (
display_name = 'From Address' ,
address = 'from@aspose.com' ),
html_body = '<b>Some body</b>' ,
is_body_html = True ,
is_draft = True ,
subject = 'Re: Some subject' ,
to = [
models . MailAddress (
display_name = 'To Address' ,
address = 'to@aspose.com' )])
Ruby
Copy email_dto = EmailDto . new (
attachments : [
Attachment . new (
name : 'some-file.txt' ,
base64_data : 'U29tZSBmaWxlIGNvbnRlbnQ=' ) ] ,
body : 'Some body' ,
body_type : 'Html' ,
delivery_notification_options : [
'OnSuccess' ,
'Delay' ] ,
from : MailAddress . new (
display_name : 'From Address' ,
address : 'from@aspose.com' ),
html_body : '<b>Some body</b>' ,
is_body_html : true ,
is_draft : true ,
subject : 'Re: Some subject' ,
to : [
MailAddress . new (
display_name : 'To Address' ,
address : 'to@aspose.com' ) ] )
Typescript
Copy let emailDto = Models . emailDto ()
. attachments ([
Models . attachment ()
. name ( 'some-file.txt' )
. base64Data ( 'U29tZSBmaWxlIGNvbnRlbnQ=' )
. build ()])
. body ( 'Some body' )
. bodyType ( 'Html' )
. deliveryNotificationOptions ([
'OnSuccess' ,
'Delay' ])
. from ( Models . mailAddress ()
. displayName ( 'From Address' )
. address ( 'from@aspose.com' )
. build ())
. htmlBody ( '<b>Some body</b>' )
. isBodyHtml ( true )
. isDraft ( true )
. subject ( 'Re: Some subject' )
. to ([
Models . mailAddress ()
. displayName ( 'To Address' )
. address ( 'to@aspose.com' )
. build ()])
. build ();
PHP
Copy $email_dto = Models :: emailDto ()
-> attachments ( array (
Models :: attachment ()
-> name ( 'some-file.txt' )
-> base64Data ( 'U29tZSBmaWxlIGNvbnRlbnQ=' )
-> build ()))
-> body ( 'Some body' )
-> bodyType ( 'Html' )
-> deliveryNotificationOptions ( array (
'OnSuccess' ,
'Delay' ))
-> from ( Models :: mailAddress ()
-> displayName ( 'From Address' )
-> address ( 'from@aspose.com' )
-> build ())
-> htmlBody ( '<b>Some body</b>' )
-> isBodyHtml ( true )
-> isDraft ( true )
-> subject ( 'Re: Some subject' )
-> to ( array (
Models :: mailAddress ()
-> displayName ( 'To Address' )
-> address ( 'to@aspose.com' )
-> build ()))
-> build ();
Convert
Converts email document to specified format and returns as file.
Email documents could be stored in different formats including EML, and Outlook MSG formats.
Also sometimes users need to convert email messages to HTML format, to view them in a web browser.
Returns a File . Requires:
request
Convert method request. Type: EmailConvertRequest .
FromFile
Converts email document to a model representation.
Returns EmailDto model. Requires:
request
FromFile method request. Type: EmailFromFileRequest .
Get
Get email document from storage.
Returns EmailDto model. Requires:
request
Get method request. Type: EmailGetRequest .
GetAsFile
Converts email document from storage to specified format and returns as file.
Returns a File . Requires:
request
GetAsFile method request. Type: EmailGetAsFileRequest .
GetList
Get email list from storage folder.
Returns EmailStorageList model. Requires:
request
GetList method request. Type: EmailGetListRequest .
C#
Copy var request = new EmailGetListRequest
{
Format = "Eml" ,
Folder = "folder/on/storage" ,
Storage = "First Storage" ,
ItemsPerPage = 10 ,
PageNumber = 0
};
Java
Copy EmailGetListRequest request = Models . emailGetListRequest ()
. format ( "Eml" )
. folder ( "folder/on/storage" )
. storage ( "First Storage" )
. itemsPerPage ( 10 )
. pageNumber ( 0 )
. build ();
Python
Copy request = models . EmailGetListRequest (
format = 'Eml' ,
folder = 'folder/on/storage' ,
storage = 'First Storage' ,
items_per_page = 10 ,
page_number = 0 )
Ruby
Copy request = EmailGetListRequest . new (
format : 'Eml' ,
folder : 'folder/on/storage' ,
storage : 'First Storage' ,
items_per_page : 10 ,
page_number : 0 )
Typescript
Copy let request = Models . EmailGetListRequest ()
. format ( 'Eml' )
. folder ( 'folder/on/storage' )
. storage ( 'First Storage' )
. itemsPerPage ( 10 )
. pageNumber ( 0 )
. build ();
PHP
Copy $request = Models :: EmailGetListRequest ()
-> format ( 'Eml' )
-> folder ( 'folder/on/storage' )
-> storage ( 'First Storage' )
-> items_per_page ( 10 )
-> page_number ( 0 )
-> build ();
Save
Save email document to storage. Requires:
request
Email document create/update request. Type: EmailSaveRequest .
C#
Copy var request = new EmailSaveRequest
{
Format = "Msg" ,
StorageFile = new StorageFileLocation
{
FileName = "email.eml" ,
Storage = "First Storage" ,
FolderPath = "file/location/folder/on/storage"
},
Value = new EmailDto
{
Attachments = new List < Attachment >
{
new Attachment
{
Name = "some-file.txt" ,
Base64Data = "U29tZSBmaWxlIGNvbnRlbnQ="
}
},
Body = "Some body" ,
BodyType = "Html" ,
DeliveryNotificationOptions = new List < EmailDeliveryNotificationOptions >
{
"OnSuccess" ,
"Delay"
},
From = new MailAddress
{
DisplayName = "From Address" ,
Address = "from@aspose.com"
},
HtmlBody = "<b>Some body</b>" ,
IsBodyHtml = true ,
IsDraft = true ,
Subject = "Re: Some subject" ,
To = new List < MailAddress >
{
new MailAddress
{
DisplayName = "To Address" ,
Address = "to@aspose.com"
}
}
}
};
Java
Copy EmailSaveRequest request = Models . emailSaveRequest ()
. format ( "Msg" )
. storageFile ( Models . storageFileLocation ()
. fileName ( "email.eml" )
. storage ( "First Storage" )
. folderPath ( "file/location/folder/on/storage" )
. build ())
. value ( Models . emailDto ()
. attachments ( Arrays .< Attachment > asList (
Models . attachment ()
. name ( "some-file.txt" )
. base64Data ( "U29tZSBmaWxlIGNvbnRlbnQ=" )
. build ()))
. body ( "Some body" )
. bodyType ( "Html" )
. deliveryNotificationOptions ( Arrays .< EmailDeliveryNotificationOptions > asList (
"OnSuccess" ,
"Delay" ))
. from ( Models . mailAddress ()
. displayName ( "From Address" )
. address ( "from@aspose.com" )
. build ())
. htmlBody ( "<b>Some body</b>" )
. isBodyHtml ( true )
. isDraft ( true )
. subject ( "Re: Some subject" )
. to ( Arrays .< MailAddress > asList (
Models . mailAddress ()
. displayName ( "To Address" )
. address ( "to@aspose.com" )
. build ()))
. build ())
. build ();
Python
Copy request = models . EmailSaveRequest (
format = 'Msg' ,
storage_file = models . StorageFileLocation (
file_name = 'email.eml' ,
storage = 'First Storage' ,
folder_path = 'file/location/folder/on/storage' ),
value = models . EmailDto (
attachments = [
models . Attachment (
name = 'some-file.txt' ,
base64_data = 'U29tZSBmaWxlIGNvbnRlbnQ=' )],
body = 'Some body' ,
body_type = 'Html' ,
delivery_notification_options = [
'OnSuccess' ,
'Delay' ],
_from = models . MailAddress (
display_name = 'From Address' ,
address = 'from@aspose.com' ),
html_body = '<b>Some body</b>' ,
is_body_html = True ,
is_draft = True ,
subject = 'Re: Some subject' ,
to = [
models . MailAddress (
display_name = 'To Address' ,
address = 'to@aspose.com' )]))
Ruby
Copy request = EmailSaveRequest . new (
format : 'Msg' ,
storage_file : StorageFileLocation . new (
file_name : 'email.eml' ,
storage : 'First Storage' ,
folder_path : 'file/location/folder/on/storage' ),
value : EmailDto . new (
attachments : [
Attachment . new (
name : 'some-file.txt' ,
base64_data : 'U29tZSBmaWxlIGNvbnRlbnQ=' ) ] ,
body : 'Some body' ,
body_type : 'Html' ,
delivery_notification_options : [
'OnSuccess' ,
'Delay' ] ,
from : MailAddress . new (
display_name : 'From Address' ,
address : 'from@aspose.com' ),
html_body : '<b>Some body</b>' ,
is_body_html : true ,
is_draft : true ,
subject : 'Re: Some subject' ,
to : [
MailAddress . new (
display_name : 'To Address' ,
address : 'to@aspose.com' ) ] ))
Typescript
Copy let request = Models . emailSaveRequest ()
. format ( 'Msg' )
. storageFile ( Models . storageFileLocation ()
. fileName ( 'email.eml' )
. storage ( 'First Storage' )
. folderPath ( 'file/location/folder/on/storage' )
. build ())
. value ( Models . emailDto ()
. attachments ([
Models . attachment ()
. name ( 'some-file.txt' )
. base64Data ( 'U29tZSBmaWxlIGNvbnRlbnQ=' )
. build ()])
. body ( 'Some body' )
. bodyType ( 'Html' )
. deliveryNotificationOptions ([
'OnSuccess' ,
'Delay' ])
. from ( Models . mailAddress ()
. displayName ( 'From Address' )
. address ( 'from@aspose.com' )
. build ())
. htmlBody ( '<b>Some body</b>' )
. isBodyHtml ( true )
. isDraft ( true )
. subject ( 'Re: Some subject' )
. to ([
Models . mailAddress ()
. displayName ( 'To Address' )
. address ( 'to@aspose.com' )
. build ()])
. build ())
. build ();
PHP
Copy $request = Models :: emailSaveRequest ()
-> format ( 'Msg' )
-> storageFile ( Models :: storageFileLocation ()
-> fileName ( 'email.eml' )
-> storage ( 'First Storage' )
-> folderPath ( 'file/location/folder/on/storage' )
-> build ())
-> value ( Models :: emailDto ()
-> attachments ( array (
Models :: attachment ()
-> name ( 'some-file.txt' )
-> base64Data ( 'U29tZSBmaWxlIGNvbnRlbnQ=' )
-> build ()))
-> body ( 'Some body' )
-> bodyType ( 'Html' )
-> deliveryNotificationOptions ( array (
'OnSuccess' ,
'Delay' ))
-> from ( Models :: mailAddress ()
-> displayName ( 'From Address' )
-> address ( 'from@aspose.com' )
-> build ())
-> htmlBody ( '<b>Some body</b>' )
-> isBodyHtml ( true )
-> isDraft ( true )
-> subject ( 'Re: Some subject' )
-> to ( array (
Models :: mailAddress ()
-> displayName ( 'To Address' )
-> address ( 'to@aspose.com' )
-> build ()))
-> build ())
-> build ();
More APIs