* @exception E_MAX_EXCEEDED The number of recipients has crossed the maximum limit (Maximum 20).
* @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @exception E_USER_NOT_CONSENTED The user blocks an application from calling this method. @b Since: @b 2.1
- * @remarks The value of the flag, @c saveToSentbox, is fixed to @c false in the emulator.
* @see IEmailListener::OnEmailMessageSent()
*/
result Send(const EmailMessage& message, const RecipientList& recipientList, bool saveToSentbox);
SysAssertf(__isConstructed == true, "The _EmailManagerImpl instance is not constructed yet.");
SysLog(NID_MSG, "sending an email message.");
- r = _MsgUtil::SendEmail(message, recipientList, msgId, requestId);
+ r = _MsgUtil::SendEmail(message, recipientList, msgId, requestId, saveToSentBox);
SysTryCatch(NID_MSG, r == E_SUCCESS, , r, "[%s] Failed to send the email message.", GetErrorMessage(r));
pTemp = new (std::nothrow) _EmailAsyncData();
return NULL;
}
result
-_MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailId, int &requestId)
+_MsgUtil::SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailId, int &requestId, bool saveToSentBox)
{
email_account_t* pAccount = NULL;
email_mail_data_t *pMail = null;
email_mailbox_t *pMailbox = null;
email_attachment_data_t **pAttach=null;
+ int tmpSaveToSentBox = -1;
int accountId = 0;
int err = EMAIL_ERROR_NONE;
result r = E_SUCCESS;
pMailbox = (email_mailbox_t *)calloc(1,sizeof(email_mailbox_t));
SysTryCatch(NID_MSG, pMailbox != null, r = E_OUT_OF_MEMORY, r, "Insufficient memory");
-
err = email_load_default_account_id(&accountId);
SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account Load is Failed.");
err = email_get_account(accountId, GET_FULL_DATA, &pAccount);
SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account is Failed.");
+ SysLog(NID_MSG, "keep %d, save %d" , pAccount->options.keep_local_copy, saveToSentBox);
+
+ tmpSaveToSentBox = pAccount->options.keep_local_copy;
+ pAccount->options.keep_local_copy = saveToSentBox;
+
+ email_update_account(accountId, pAccount);
+ SysTryCatch(NID_MSG, err == EMAIL_ERROR_NONE, r = E_INVALID_ACCOUNT, r, "Account update is Failed.");
fromAddr.Append(L'\"');
fromAddr.Append(pAccount->incoming_server_user_name);
r = AddEmailCallBackToDbus();
+ if (-1 != tmpSaveToSentBox)
+ {
+ pAccount->options.keep_local_copy = (bool)tmpSaveToSentBox;
+ email_update_account(accountId, pAccount);
+ }
+
+
if (pAttach)
{
if (*pAttach)
return r;
CATCH:
+
+ if (-1 != tmpSaveToSentBox)
+ {
+ pAccount->options.keep_local_copy = (bool)tmpSaveToSentBox;
+ email_update_account(accountId, pAccount);
+ }
+
+
if (pAttach)
{
if (*pAttach)
static SmsMessage* ConvertSmsMessageN(const SmsMessageBoxType& type, msg_struct_t& msg);
static int AddMessageAddress(const RecipientList& recipientList, RecipientType type, msg_struct_t& messageMsg, _MSG_RECIPIENT_TYPE_E recipientType);
static result AddEmailMessageAddress(const RecipientList& recipientList, RecipientType type, email_mail_data_t *pMail);
- static result SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailboxId, int &requestId);
+ static result SendEmail(const EmailMessage& message, const RecipientList& recipientList, int &mailboxId, int &requestId, bool saveToSentBox);
static result AddEmailMessageBody(email_mail_data_t *pMail, char * pBody);
static result AddEmailMessageAttachment(const EmailMessage& message, email_attachment_data_t ***pAttach, email_mail_data_t *pMail);
static result AddEmailCallBackToDbus(void);