| Requires any of the roles: | Client, Admin, Partner |
| POST | /communication/sendmail | Sends an email |
|---|
import Foundation
import ServiceStack
public class SendMailRequest : Codable
{
/**
* Email address of sender. If it is not set the a default address will be used.
*/
// @ApiMember(Description="Email address of sender. If it is not set the a default address will be used.")
public var fromAddress:String
/**
* List of recipient email addresses
*/
// @ApiMember(Description="List of recipient email addresses", IsRequired=true)
public var recipients:[String]
/**
* Email subject
*/
// @ApiMember(Description="Email subject", IsRequired=true)
public var subject:String
/**
* Plain text body. Either this or HtmlBody is required
*/
// @ApiMember(Description="Plain text body. Either this or HtmlBody is required")
public var body:String
/**
* Html body. Either this or Body is required
*/
// @ApiMember(Description="Html body. Either this or Body is required")
public var htmlBody:String
/**
* Email attachments
*/
// @ApiMember(Description="Email attachments")
public var attachments:[String]
/**
* Email attachments
*/
// @ApiMember(Description="Email attachments")
public var attachmentsObject:[Attachment]
/**
* Attachment streams
*/
// @ApiMember(Description="Attachment streams")
public var attachmentStreams:[AttachmentStream]
/**
* Template substitutions
*/
// @ApiMember(Description="Template substitutions")
public var templateSubstitutions:[String:String]
/**
* Template Id
*/
// @ApiMember(Description="Template Id")
public var templateId:String
/**
* List of BCC email addresses
*/
// @ApiMember(Description="List of BCC email addresses")
public var bcc:[String]
/**
* List of CC email addresses
*/
// @ApiMember(Description="List of CC email addresses")
public var cc:[String]
required public init(){}
}
public class Attachment : Codable
{
public var content:String
public var type:String
public var filename:String
public var disposition:String
public var contentId:String
required public init(){}
}
public class AttachmentStream : Codable
{
public var stream:Data
public var name:String
public var type:String
public var disposition:String
public var contentid:String
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /communication/sendmail HTTP/1.1
Host: duengageapi.uat.scadsoftware.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<SendMailRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/digitaluapi.ServiceModel">
<AttachmentStreams>
<AttachmentStream>
<Contentid>String</Contentid>
<Disposition>String</Disposition>
<Name>String</Name>
<Stream xmlns:d4p1="http://schemas.datacontract.org/2004/07/System.IO" i:nil="true" />
<Type>String</Type>
</AttachmentStream>
</AttachmentStreams>
<Attachments xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:string>String</d2p1:string>
</Attachments>
<AttachmentsObject>
<Attachment>
<Content>String</Content>
<ContentId>String</ContentId>
<Disposition>String</Disposition>
<Filename>String</Filename>
<Type>String</Type>
</Attachment>
</AttachmentsObject>
<Bcc xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
<Body>String</Body>
<Cc xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
<FromAddress>String</FromAddress>
<HtmlBody>String</HtmlBody>
<Recipients xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" i:nil="true" />
<Subject>String</Subject>
<TemplateId>String</TemplateId>
<TemplateSubstitutions xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</TemplateSubstitutions>
</SendMailRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />