blob: 2bde42aa018dd76b9b65c42d7a96c3089200d395 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
using System;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace SendGrid.Helpers.Mail
{
/// <summary>
/// Class Mail builds an object that sends an email through SendGrid.
/// </summary>
public class SendGridMessage
{
[JsonProperty(PropertyName = "from")]
public EmailAddress From { get; set; }
[JsonProperty(PropertyName = "subject")]
public string Subject { get; set; }
[JsonProperty(PropertyName = "personalizations")]
public List<Personalization> Personalization { get; set; }
[JsonProperty(PropertyName = "content")]
public List<Content> Contents { get; set; }
[JsonProperty(PropertyName = "attachments")]
public List<Attachment> Attachments { get; set; }
[JsonProperty(PropertyName = "template_id")]
public string TemplateId { get; set; }
[JsonProperty(PropertyName = "headers")]
public Dictionary<string, string> Headers { get; set; }
[JsonProperty(PropertyName = "sections")]
public Dictionary<string, string> Sections { get; set; }
[JsonProperty(PropertyName = "categories")]
public List<string> Categories { get; set; }
[JsonProperty(PropertyName = "custom_args")]
public Dictionary<string, string> CustomArgs { get; set; }
[JsonProperty(PropertyName = "send_at")]
public long? SendAt { get; set; }
[JsonProperty(PropertyName = "asm")]
public ASM Asm { get; set; }
[JsonProperty(PropertyName = "batch_id")]
public string BatchId { get; set; }
[JsonProperty(PropertyName = "ip_pool_name")]
public string SetIpPoolId { get; set; }
[JsonProperty(PropertyName = "mail_settings")]
public MailSettings MailSettings { get; set; }
[JsonProperty(PropertyName = "tracking_settings")]
public TrackingSettings TrackingSettings { get; set; }
[JsonProperty(PropertyName = "reply_to")]
public EmailAddress ReplyTo { get; set; }
public string Serialize()
{
return JsonConvert.SerializeObject(this,
Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore,
DefaultValueHandling = DefaultValueHandling.Include,
StringEscapeHandling = StringEscapeHandling.EscapeHtml
});
}
}
}
|