-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathMail.cpp
48 lines (39 loc) · 856 Bytes
/
Mail.cpp
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
#include "Mail.h"
Mail::Mail() {
_from = NULL;
_replyTo = NULL;
memset(_recipients, NULL, sizeof(_recipients));
memset(_recipientTypes, 0, sizeof(_recipientTypes));
_recipientCount = 0;
_subject = NULL;
_body = NULL;
}
void Mail::from(char *from) {
_from = from;
}
void Mail::replyTo(char *replyTo) {
_replyTo = replyTo;
}
void Mail::to(char *to) {
addRecipient(TO, to);
}
void Mail::cc(char *cc) {
addRecipient(CC, cc);
}
void Mail::bcc(char *bcc) {
addRecipient(BCC, bcc);
}
void Mail::subject(char *subject) {
_subject = subject;
}
void Mail::body(char *body) {
_body = body;
}
void Mail::addRecipient(recipient_t type, char* recipient) {
if (_recipientCount == MAIL_LIB_MAX_RECIPIENTS) {
return;
}
_recipientTypes[_recipientCount] = type;
_recipients[_recipientCount] = recipient;
_recipientCount++;
}