-
Notifications
You must be signed in to change notification settings - Fork 478
/
SimpleEmailEvent.cs
232 lines (197 loc) · 7.62 KB
/
SimpleEmailEvent.cs
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
using Amazon.Lambda.SimpleEmailEvents.Actions;
using System;
using System.Collections.Generic;
namespace Amazon.Lambda.SimpleEmailEvents
{
/// <summary>
/// Simple Email Service event
/// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ses-email-receiving
/// </summary>
public class SimpleEmailEvent<TReceiptAction> where TReceiptAction : IReceiptAction
{
/// <summary>
/// List of SES records.
/// </summary>
public IList<SimpleEmailRecord<TReceiptAction>> Records { get; set; }
/// <summary>
/// An SES record.
/// </summary>
public class SimpleEmailRecord<TReceiptAction> where TReceiptAction : IReceiptAction
{
/// <summary>
/// The event version.
/// </summary>
public string EventVersion { get; set; }
/// <summary>
/// The event source.
/// </summary>
public string EventSource { get; set; }
/// <summary>
/// The SES message.
/// </summary>
public SimpleEmailService<TReceiptAction> Ses { get; set; }
}
/// <summary>
/// An SES record.
/// </summary>
[Obsolete(
"Please move to using SimpleEmailRecord<TReceiptAction> for greater flexibility over which type of action this record refers to. For a like for like replacement on lambda actions, please use SimpleEmailRecord<LambdaReceiptAction>"
)]
public class SimpleEmailRecord : SimpleEmailRecord<LambdaReceiptAction>
{ }
/// <summary>
/// An SES message record.
/// </summary>
public class SimpleEmailService<TReceiptAction> where TReceiptAction : IReceiptAction
{
/// <summary>
/// The mail data for the SES message.
/// </summary>
public SimpleEmailMessage Mail { get; set; }
/// <summary>
/// The receipt data for the SES message.
/// </summary>
public SimpleEmailReceipt<TReceiptAction> Receipt { get; set; }
}
/// <summary>
/// The mail data for the SES message.
/// </summary>
public class SimpleEmailMessage
{
/// <summary>
/// A few of the most important headers from the message.
/// </summary>
public SimpleEmailCommonHeaders CommonHeaders { get; set; }
/// <summary>
/// The source email address of the message, i.e. SMTP FROM.
/// </summary>
public string Source { get; set; }
/// <summary>
/// The timestamp of the message.
/// </summary>
public DateTime Timestamp { get; set; }
/// <summary>
/// The destination recipients of the message.
/// </summary>
public IList<string> Destination { get; set; }
/// <summary>
/// The headers associated with the message.
/// </summary>
public IList<SimpleEmailHeader> Headers { get; set; }
/// <summary>
/// Whether or not the Headers property is truncated.
/// </summary>
public bool HeadersTruncated { get; set; }
/// <summary>
/// The SES Message ID, which will also be the filename of the S3 object containing the message. Not to be confused with the incoming message's Message-ID header.
/// </summary>
public string MessageId { get; set; }
}
/// <summary>
/// The receipt data for the SES message.
/// </summary>
/// <typeparam name="TAction">The type of action being received in this receipt</typeparam>
public class SimpleEmailReceipt<TReceiptAction> where TReceiptAction : IReceiptAction
{
/// <summary>
/// The recipients of the message.
/// </summary>
public IList<string> Recipients { get; set; }
/// <summary>
/// The timestamp of the message.
/// </summary>
public DateTime Timestamp { get; set; }
/// <summary>
/// The spam verdict of the message, e.g. status: PASS.
/// </summary>
public SimpleEmailVerdict SpamVerdict { get; set; }
/// <summary>
/// The DKIM verdict of the message, e.g. status: PASS.
/// </summary>
public SimpleEmailVerdict DKIMVerdict { get; set; }
/// <summary>
/// The SPF verdict of the message, e.g. status: PASS.
/// </summary>
public SimpleEmailVerdict SPFVerdict { get; set; }
/// <summary>
/// The virus verdict of the message, e.g. status: PASS.
/// </summary>
public SimpleEmailVerdict VirusVerdict { get; set; }
/// <summary>
/// The DMARC verdict of the message, e.g. status: PASS.
/// </summary>
public SimpleEmailVerdict DMARCVerdict { get; set; }
/// <summary>
/// The action of the message (i.e, which lambda was invoked, where it was stored in S3, etc)
/// </summary>
public TReceiptAction Action { get; set; }
/// <summary>
/// How long this incoming message took to process.
/// </summary>
public long ProcessingTimeMillis { get; set; }
}
/// <summary>
/// An SES message header.
/// </summary>
public class SimpleEmailHeader
{
/// <summary>
/// The header name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// The header value.
/// </summary>
public string Value { get; set; }
}
}
/// <summary>
/// A few of the most important headers of the message.
/// </summary>
public class SimpleEmailCommonHeaders
{
/// <summary>
/// The From header's address(es)
/// </summary>
public IList<string> From { get; set; }
/// <summary>
/// The To header's address(es)
/// </summary>
public IList<string> To { get; set; }
/// <summary>
/// The Return-Path header.
/// </summary>
public string ReturnPath { get; set; }
/// <summary>
/// The incoming message's Message-ID header. Not to be confused with the SES messageId.
/// </summary>
public string MessageId { get; set; }
/// <summary>
/// The Date header.
/// </summary>
public string Date { get; set; }
/// <summary>
/// The Subject header.
/// </summary>
public string Subject { get; set; }
}
/// <summary>
/// Verdict to return status of Spam, DKIM, SPF, Virus, and DMARC.
/// </summary>
public class SimpleEmailVerdict
{
/// <summary>
/// The verdict status, e.g. PASS or FAIL.
/// </summary>
public string Status { get; set; }
}
/// <summary>
/// Simple Email Service event
/// http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html#eventsources-ses-email-receiving
/// </summary>
[Obsolete(
"Please move to using SimpleEmailEvent<TReceiptAction>, which allows greater flexibility over which type of event is being handled. For a like for like replacement if using a lambda event, use SimpleEmailEvent<LambdaReceiptAction>"
)]
public class SimpleEmailEvent : SimpleEmailEvent<LambdaReceiptAction>
{ }
}