| Requires any of the roles: | Client, Admin, Partner |
| POST | /communication/sendmail | Sends an email |
|---|
import java.math.*;
import java.util.*;
import java.io.InputStream;
import net.servicestack.client.*;
public class dtos
{
public static class SendMailRequest
{
/**
* 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 String FromAddress = null;
/**
* List of recipient email addresses
*/
@ApiMember(Description="List of recipient email addresses", IsRequired=true)
public ArrayList<String> Recipients = null;
/**
* Email subject
*/
@ApiMember(Description="Email subject", IsRequired=true)
public String Subject = null;
/**
* Plain text body. Either this or HtmlBody is required
*/
@ApiMember(Description="Plain text body. Either this or HtmlBody is required")
public String Body = null;
/**
* Html body. Either this or Body is required
*/
@ApiMember(Description="Html body. Either this or Body is required")
public String HtmlBody = null;
/**
* Email attachments
*/
@ApiMember(Description="Email attachments")
public ArrayList<String> Attachments = null;
/**
* Email attachments
*/
@ApiMember(Description="Email attachments")
public ArrayList<Attachment> AttachmentsObject = null;
/**
* Attachment streams
*/
@ApiMember(Description="Attachment streams")
public ArrayList<AttachmentStream> AttachmentStreams = null;
/**
* Template substitutions
*/
@ApiMember(Description="Template substitutions")
public HashMap<String,String> TemplateSubstitutions = null;
/**
* Template Id
*/
@ApiMember(Description="Template Id")
public String TemplateId = null;
/**
* List of BCC email addresses
*/
@ApiMember(Description="List of BCC email addresses")
public ArrayList<String> Bcc = null;
/**
* List of CC email addresses
*/
@ApiMember(Description="List of CC email addresses")
public ArrayList<String> Cc = null;
public String getFromAddress() { return FromAddress; }
public SendMailRequest setFromAddress(String value) { this.FromAddress = value; return this; }
public ArrayList<String> getRecipients() { return Recipients; }
public SendMailRequest setRecipients(ArrayList<String> value) { this.Recipients = value; return this; }
public String getSubject() { return Subject; }
public SendMailRequest setSubject(String value) { this.Subject = value; return this; }
public String getBody() { return Body; }
public SendMailRequest setBody(String value) { this.Body = value; return this; }
public String getHtmlBody() { return HtmlBody; }
public SendMailRequest setHtmlBody(String value) { this.HtmlBody = value; return this; }
public ArrayList<String> getAttachments() { return Attachments; }
public SendMailRequest setAttachments(ArrayList<String> value) { this.Attachments = value; return this; }
public ArrayList<Attachment> getAttachmentsObject() { return AttachmentsObject; }
public SendMailRequest setAttachmentsObject(ArrayList<Attachment> value) { this.AttachmentsObject = value; return this; }
public ArrayList<AttachmentStream> getAttachmentStreams() { return AttachmentStreams; }
public SendMailRequest setAttachmentStreams(ArrayList<AttachmentStream> value) { this.AttachmentStreams = value; return this; }
public HashMap<String,String> getTemplateSubstitutions() { return TemplateSubstitutions; }
public SendMailRequest setTemplateSubstitutions(HashMap<String,String> value) { this.TemplateSubstitutions = value; return this; }
public String getTemplateId() { return TemplateId; }
public SendMailRequest setTemplateId(String value) { this.TemplateId = value; return this; }
public ArrayList<String> getBcc() { return Bcc; }
public SendMailRequest setBcc(ArrayList<String> value) { this.Bcc = value; return this; }
public ArrayList<String> getCc() { return Cc; }
public SendMailRequest setCc(ArrayList<String> value) { this.Cc = value; return this; }
}
public static class Attachment
{
public String Content = null;
public String Type = null;
public String Filename = null;
public String Disposition = null;
public String ContentId = null;
public String getContent() { return Content; }
public Attachment setContent(String value) { this.Content = value; return this; }
public String getType() { return Type; }
public Attachment setType(String value) { this.Type = value; return this; }
public String getFilename() { return Filename; }
public Attachment setFilename(String value) { this.Filename = value; return this; }
public String getDisposition() { return Disposition; }
public Attachment setDisposition(String value) { this.Disposition = value; return this; }
public String getContentId() { return ContentId; }
public Attachment setContentId(String value) { this.ContentId = value; return this; }
}
public static class AttachmentStream
{
public InputStream Stream = null;
public String Name = null;
public String Type = null;
public String Disposition = null;
public String Contentid = null;
public InputStream getStream() { return Stream; }
public AttachmentStream setStream(InputStream value) { this.Stream = value; return this; }
public String getName() { return Name; }
public AttachmentStream setName(String value) { this.Name = value; return this; }
public String getType() { return Type; }
public AttachmentStream setType(String value) { this.Type = value; return this; }
public String getDisposition() { return Disposition; }
public AttachmentStream setDisposition(String value) { this.Disposition = value; return this; }
public String getContentid() { return Contentid; }
public AttachmentStream setContentid(String value) { this.Contentid = value; return this; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
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: text/jsv
Content-Type: text/jsv
Content-Length: length
{
FromAddress: String,
Subject: String,
Body: String,
HtmlBody: String,
Attachments:
[
String
],
AttachmentsObject:
[
{
Content: String,
Type: String,
Filename: String,
Disposition: String,
ContentId: String
}
],
AttachmentStreams:
[
{
Name: String,
Type: String,
Disposition: String,
Contentid: String
}
],
TemplateSubstitutions:
{
String: String
},
TemplateId: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
}