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
|
//
// SMTPSendWithDataOperation.cc
// mailcore2
//
// Created by DINH Viêt Hoà on 1/10/13.
// Copyright (c) 2013 MailCore. All rights reserved.
//
#include "MCSMTPSendWithDataOperation.h"
#include "MCSMTPAsyncSession.h"
#include "MCSMTPSession.h"
using namespace mailcore;
SMTPSendWithDataOperation::SMTPSendWithDataOperation()
{
mMessageData = NULL;
mMessageFilepath = NULL;
mFrom = NULL;
mRecipients = NULL;
}
SMTPSendWithDataOperation::~SMTPSendWithDataOperation()
{
MC_SAFE_RELEASE(mFrom);
MC_SAFE_RELEASE(mRecipients);
MC_SAFE_RELEASE(mMessageFilepath);
MC_SAFE_RELEASE(mMessageData);
}
void SMTPSendWithDataOperation::setMessageData(Data * data)
{
MC_SAFE_REPLACE_RETAIN(Data, mMessageData, data);
}
Data * SMTPSendWithDataOperation::messageData()
{
return mMessageData;
}
void SMTPSendWithDataOperation::setMessageFilepath(String * path)
{
MC_SAFE_REPLACE_RETAIN(String, mMessageFilepath, path);
}
String * SMTPSendWithDataOperation::messageFilepath()
{
return mMessageFilepath;
}
void SMTPSendWithDataOperation::setFrom(Address * from)
{
MC_SAFE_REPLACE_COPY(Address, mFrom, from);
}
Address * SMTPSendWithDataOperation::from()
{
return mFrom;
}
void SMTPSendWithDataOperation::setRecipients(Array * recipients)
{
MC_SAFE_REPLACE_COPY(Array, mRecipients, recipients);
}
Array * SMTPSendWithDataOperation::recipients()
{
return mRecipients;
}
void SMTPSendWithDataOperation::main()
{
ErrorCode error;
if (mMessageFilepath != NULL) {
session()->session()->sendMessage(mFrom, mRecipients, mMessageFilepath, this, &error);
}
else
if ((mFrom != NULL) && (mRecipients != NULL)) {
session()->session()->sendMessage(mFrom, mRecipients, mMessageData, this, &error);
}
else {
session()->session()->sendMessage(mMessageData, this, &error);
}
setError(error);
}
|