| Requires any of the roles: | Client, Admin, Partner |
| POST | /communication/sendmail | Sends an email |
|---|
import 'package:servicestack/servicestack.dart';
class Attachment implements IConvertible
{
String? Content;
String? Type;
String? Filename;
String? Disposition;
String? ContentId;
Attachment({this.Content,this.Type,this.Filename,this.Disposition,this.ContentId});
Attachment.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Content = json['Content'];
Type = json['Type'];
Filename = json['Filename'];
Disposition = json['Disposition'];
ContentId = json['ContentId'];
return this;
}
Map<String, dynamic> toJson() => {
'Content': Content,
'Type': Type,
'Filename': Filename,
'Disposition': Disposition,
'ContentId': ContentId
};
getTypeName() => "Attachment";
TypeContext? context = _ctx;
}
class AttachmentStream implements IConvertible
{
Uint8List? Stream;
String? Name;
String? Type;
String? Disposition;
String? Contentid;
AttachmentStream({this.Stream,this.Name,this.Type,this.Disposition,this.Contentid});
AttachmentStream.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Stream = JsonConverters.fromJson(json['Stream'],'Uint8List',context!);
Name = json['Name'];
Type = json['Type'];
Disposition = json['Disposition'];
Contentid = json['Contentid'];
return this;
}
Map<String, dynamic> toJson() => {
'Stream': JsonConverters.toJson(Stream,'Uint8List',context!),
'Name': Name,
'Type': Type,
'Disposition': Disposition,
'Contentid': Contentid
};
getTypeName() => "AttachmentStream";
TypeContext? context = _ctx;
}
class SendMailRequest implements IConvertible
{
/**
* 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.")
String? FromAddress;
/**
* List of recipient email addresses
*/
// @ApiMember(Description="List of recipient email addresses", IsRequired=true)
List<String>? Recipients;
/**
* Email subject
*/
// @ApiMember(Description="Email subject", IsRequired=true)
String? Subject;
/**
* Plain text body. Either this or HtmlBody is required
*/
// @ApiMember(Description="Plain text body. Either this or HtmlBody is required")
String? Body;
/**
* Html body. Either this or Body is required
*/
// @ApiMember(Description="Html body. Either this or Body is required")
String? HtmlBody;
/**
* Email attachments
*/
// @ApiMember(Description="Email attachments")
List<String>? Attachments;
/**
* Email attachments
*/
// @ApiMember(Description="Email attachments")
List<Attachment>? AttachmentsObject;
/**
* Attachment streams
*/
// @ApiMember(Description="Attachment streams")
List<AttachmentStream>? AttachmentStreams;
/**
* Template substitutions
*/
// @ApiMember(Description="Template substitutions")
Map<String,String?>? TemplateSubstitutions;
/**
* Template Id
*/
// @ApiMember(Description="Template Id")
String? TemplateId;
/**
* List of BCC email addresses
*/
// @ApiMember(Description="List of BCC email addresses")
List<String>? Bcc;
/**
* List of CC email addresses
*/
// @ApiMember(Description="List of CC email addresses")
List<String>? Cc;
SendMailRequest({this.FromAddress,this.Recipients,this.Subject,this.Body,this.HtmlBody,this.Attachments,this.AttachmentsObject,this.AttachmentStreams,this.TemplateSubstitutions,this.TemplateId,this.Bcc,this.Cc});
SendMailRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
FromAddress = json['FromAddress'];
Recipients = JsonConverters.fromJson(json['Recipients'],'List<String>',context!);
Subject = json['Subject'];
Body = json['Body'];
HtmlBody = json['HtmlBody'];
Attachments = JsonConverters.fromJson(json['Attachments'],'List<String>',context!);
AttachmentsObject = JsonConverters.fromJson(json['AttachmentsObject'],'List<Attachment>',context!);
AttachmentStreams = JsonConverters.fromJson(json['AttachmentStreams'],'List<AttachmentStream>',context!);
TemplateSubstitutions = JsonConverters.toStringMap(json['TemplateSubstitutions']);
TemplateId = json['TemplateId'];
Bcc = JsonConverters.fromJson(json['Bcc'],'List<String>',context!);
Cc = JsonConverters.fromJson(json['Cc'],'List<String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'FromAddress': FromAddress,
'Recipients': JsonConverters.toJson(Recipients,'List<String>',context!),
'Subject': Subject,
'Body': Body,
'HtmlBody': HtmlBody,
'Attachments': JsonConverters.toJson(Attachments,'List<String>',context!),
'AttachmentsObject': JsonConverters.toJson(AttachmentsObject,'List<Attachment>',context!),
'AttachmentStreams': JsonConverters.toJson(AttachmentStreams,'List<AttachmentStream>',context!),
'TemplateSubstitutions': TemplateSubstitutions,
'TemplateId': TemplateId,
'Bcc': JsonConverters.toJson(Bcc,'List<String>',context!),
'Cc': JsonConverters.toJson(Cc,'List<String>',context!)
};
getTypeName() => "SendMailRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'duengageapi.uat.scadsoftware.com', types: <String, TypeInfo> {
'Attachment': TypeInfo(TypeOf.Class, create:() => Attachment()),
'AttachmentStream': TypeInfo(TypeOf.Class, create:() => AttachmentStream()),
'Uint8List': TypeInfo(TypeOf.Class, create:() => Uint8List(0)),
'SendMailRequest': TypeInfo(TypeOf.Class, create:() => SendMailRequest()),
'List<Attachment>': TypeInfo(TypeOf.Class, create:() => <Attachment>[]),
'List<AttachmentStream>': TypeInfo(TypeOf.Class, create:() => <AttachmentStream>[]),
});
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
{
}