SendRawEmailAsync
1. Facts
info
Send an email within attachments, without template.
Method URL
<base url>/send-raw-email
Preferred HTTP method: POST
Header
Authorization: Basic <Your secret string>
ApplicationName: <Your application name>
Body (JSON)
{
"senderAddress": "AMES ENGLISH<mailer@ames.edu.vn>",
"receiverAddress": "tungnt@ames.edu.vn, tungnt@softech.vn",
"ccAddress": "ngothanhtung.it@gmail.com",
"bccAddress": "tung.ngo@outlook.com",
"subject": "Send SES (SendRawEmailAsync)",
"textBody": "This email was sent through Amazon SES",
"htmlBody": "<h1>This email was sent through Amazon SES</h1>",
"base64StringItems": {
"base64String": "Binary file that was converted to base64 string",
"fileName": "ket-qua-hoc-tap.pdf"
}
}
Response
{
"ok": true
}
2. Example (C#)
var bytes = File.ReadAllBytes("D:\\ket-qua-hoc-tap.pdf");
var base64String = Convert.ToBase64String(bytes);
var base64StringItems = new List<dynamic>();
base64StringItems.Add(new { base64String: base64String, fileName: "ket-qua-hoc-tap.pdf" });
// You can add more files.
var client = new RestClient("https://softech.cloud/api/v1/aws/ses/send-raw-email");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Basic <Your secret string>");
request.AddHeader("ApplicationName", "EBM");
var body = new {
senderAddress = "AMES ENGLISH<mailer@ames.edu.vn>",
receiverAddress = "tungnt@ames.edu.vn, tungnt@softech.vn",
subject = "Send SES (SendRawEmailAsync)",
textBody= "This email was sent through Amazon SES",
htmlBody = "<h1>This email was sent through Amazon SES</h1>"
base64StringItems = base64StringItems
};
request.AddJsonBody(body);
IRestResponse response = client.Execute(request);