upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:24 +0000 (16:58 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:58:24 +0000 (16:58 +0900)
.gitignore [deleted file]
capi-messaging-email.pc.in
debian/changelog
debian/control
include/email_private.h
packaging/capi-messaging-email.spec
src/email.c

diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index 430765c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-cmake_build_tmp/
-build-stamp
-configure-stamp
-capi-messaging-email.pc
-debian/tmp/
-debian/substvars/
-debian/files
-debian/capi-messaging-email-dbg.debhelper.log
-debian/capi-messaging-email-dbg.substvars
-debian/capi-messaging-email-dbg/
-debian/capi-messaging-email-dev.debhelper.log
-debian/capi-messaging-email-dev.substvars
-debian/capi-messaging-email-dev/
-debian/capi-messaging-email.debhelper.log
-debian/capi-messaging-email.postinst.debhelper
-debian/capi-messaging-email.postrm.debhelper
-debian/capi-messaging-email.substvars
-debian/capi-messaging-email/
index c3e189ebeb9e6fd8ecb14ab191aaaae316669cb4..9dc94c85991dc1b85dddf4760260826420de94da 100755 (executable)
@@ -4,7 +4,7 @@
 prefix=@PREFIX@
 exec_prefix=/usr
 libdir=/usr/lib
-includedir=/usr/include/messaging
+includedir=/usr/include
 
 Name: @PC_NAME@
 Description: @PACKAGE_DESCRIPTION@
index cb8b603b20c68ac40d4506e5c4cb6eb259812241..65cc4e66bf6d3a2d9db9cbbfdbf28b61f544bc92 100755 (executable)
@@ -1,3 +1,35 @@
+capi-messaging-email (0.1.1-2) unstable; urgency=low
+
+  * Fix to check the filepath in email_add_attach().
+  * Git: slp/api/email
+  * Tag: capi-messaging-email_0.1.1-2
+
+ -- WonYoung Choi <wy80.choi@samsung.com>  Fri, 13 Apr 2012 15:38:47 +0900
+
+capi-messaging-email (0.1.1-1) unstable; urgency=low
+
+  * Changes for modified email-service API.
+  * Git: slp/api/email
+  * Tag: capi-messaging-email_0.1.1-1
+
+ -- Kyuho Jo <kyuho.jo@samsung.com>  Wed, 21 Mar 2012 14:39:33 +0900
+
+capi-messaging-email (0.1.0-12) unstable; urgency=low
+
+  * Bugs fix of email_add_attach(), email_remove_all_attachments(), email_add_recipient()
+  * Git: slp/api/email
+  * Tag: capi-messaging-email_0.1.0-12 
+
+ -- WonYoung Choi <wy80.choi@samsung.com>  Thu, 08 Mar 2012 22:40:36 +0900
+
+capi-messaging-email (0.1.0-11) unstable; urgency=low
+
+  * Remove -Werror option to avoid a build-break temporary.
+  * Git: slp/api/email
+  * Tag: capi-messaging-email_0.1.0-11
+
+ -- WonYoung Choi <wy80.choi@samsung.com>  Tue, 06 Mar 2012 11:54:01 +0900
+
 capi-messaging-email (0.1.0-10) unstable; urgency=low
 
   * fix a bug of email_add_attach()
index dd288af7629c165ef73f7a205c7ce443d743379d..c028234167181c2dd60d7ef5bce75aaa6c596fdc 100755 (executable)
@@ -7,7 +7,7 @@ Build-Depends: debhelper (>= 5), dlog-dev,libglib2.0-dev , libedbus-dev, capi-ap
 
 Package: capi-messaging-email
 Architecture: any
-Depends: ${shilbs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Email library in Tizen Native API
 
 Package: capi-messaging-email-dev
index 87fd999787c096beaff47f8ee99eb211c9515e64..02c2f1b09a62de524120ccc45bc5e9478753a58a 100755 (executable)
 #ifndef __TIZEN_EMAIL_PRIVATE_TYPES_H__
 #define __TIZEN_EMAIL_PRIVATE_TYPES_H__
 
-#include <emf-types.h>
+#include <email-types.h>
 #ifdef __cplusplus
 extern "C"
 {
 #endif
 
+#define MAX_ATTACHEMENT_COUNT           50
 
 #define MAX_RECIPIENT_ADDRESS_LEN      234
 #define MAX_RECIPIENT_COUNT            50 
 #define MAX_RECIPIENT_ADDRESSES_LEN    (MAX_RECIPIENT_ADDRESS_LEN*MAX_RECIPIENT_COUNT)
 
-typedef struct  _email_s{
-       
-       emf_mail_t *mail;
+typedef struct _email_s {
        emf_mailbox_t *mbox;
+       emf_mail_data_t *mail;
+       emf_attachment_data_t attachment[MAX_ATTACHEMENT_COUNT];
 } email_s;
 
 typedef  struct _mailstatus_s {
-        int mailId;
-        int accountId;
-        int status;
-        int errorCode;
-    }mailstatus_s;
+       int mailId;
+       int accountId;
+       int status;
+       int errorCode;
+mailstatus_s;
 
 #ifdef __cplusplus
 }
index a65adc2b3b29314950680e8d883ee5f59b08286b..9c1cce726fbccecb6f2551fe7f313e414c39be16 100644 (file)
@@ -1,7 +1,7 @@
 Name:       capi-messaging-email
 Summary:    Email library in Tizen Native API
-Version:    0.1.0
-Release:    1.1
+Version: 0.1.1
+Release:    2
 Group:      TO_BE/FILLED_IN
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
@@ -32,9 +32,8 @@ Requires: %{name} = %{version}-%{release}
 
 
 %build
-FULLVER=%{version}
-MAJORVER=`echo ${FULLVER} | cut -d '.' -f 1`
-cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
+MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`  
+cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} 
 
 
 make %{?jobs:-j%jobs}
@@ -49,9 +48,10 @@ rm -rf %{buildroot}
 
 
 %files
-%{_libdir}/libcapi-messaging-email.so*
+%{_libdir}/libcapi-messaging-email.so.*
 
 %files devel
 %{_includedir}/messaging/*.h
 %{_libdir}/pkgconfig/*.pc
+%{_libdir}/libcapi-messaging-email.so
 
index 23b114fa4bf64349dd53b1cfa913eba2f52b5be9..46f56672321b20bc60f1aae2b357d9bdd2665094 100755 (executable)
 #include <memory.h>
 #include <dlog.h>
 #include <E_DBus.h>
-#include <emf-types.h>
-#include <Emf_Mapi_Account.h>
-#include <Emf_Mapi_Message.h>
-#include <Emf_Mapi_Network.h>
-#include <Emf_Mapi_Mailbox.h>
-#include <Emf_Mapi_Init.h>
+#include <email-api-mail.h>
+#include <email-api-account.h>
+#include <email-api-network.h>
+#include <email-api-mailbox.h>
+#include <email-api-init.h>
+#include <email-api.h>
 
 #include<email.h>
 #include<email_private.h>
@@ -45,57 +45,30 @@ typedef struct {
 GSList *gEmailcbList= NULL;
 //------------- Utility Or Miscellaneous
 void _email_add_dbus_filter(void);
-int _email_error_converter(int err);
+int _email_error_converter(int err, const char *func, int line);
+
+#define CONVERT_ERROR(err) _email_error_converter(err, __FUNCTION__, __LINE__);
 
 //------------------------------------
 
-int  email_create_message(email_h *msg)
+int email_create_message(email_h *msg)
 {
        int ret;
        email_s * msg_s = NULL;
        emf_account_t* account = NULL;
-       int i,cnt,len;
+       int cnt,len;
 
        // 1. create service for ipc
        ret=email_service_begin();
        msg_s= (email_s*)calloc(1,sizeof(email_s));
        if (msg_s != NULL)
        {
-               msg_s->mail = (emf_mail_t *)calloc(1,sizeof(emf_mail_t));
-               if (msg_s->mail != NULL)
-               {
-               
-                       msg_s->mail->head = (emf_mail_head_t *)calloc(1,sizeof(emf_mail_head_t));
-                       if(msg_s->mail->head == NULL)
-                       {
-                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->head", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
-                               free(msg_s);
-                               return EMAIL_ERROR_OUT_OF_MEMORY;
-                       }
-
-                       msg_s->mail->body = (emf_mail_body_t *)calloc(1,sizeof(emf_mail_body_t));
-                       if (msg_s->mail->body  == NULL)
-                       {
-                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->body", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
-                               free(msg_s);
-                               return EMAIL_ERROR_OUT_OF_MEMORY;
-                       }
-
-
-                       msg_s->mail->info = (emf_mail_info_t *)calloc(1,sizeof(emf_mail_info_t));
-                       if (msg_s->mail->info  == NULL)
-                       {
-                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->info", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
-                               free(msg_s);
-                               return EMAIL_ERROR_OUT_OF_MEMORY;
-                       }
-               }
-               else
-               {
+               msg_s->mail = (emf_mail_data_t *)calloc(1,sizeof(emf_mail_data_t));
+               if (msg_s->mail == NULL) {
                        LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                        free(msg_s);
                        return EMAIL_ERROR_OUT_OF_MEMORY;
-                       }
+               }
 
                msg_s->mbox = (emf_mailbox_t *)calloc(1,sizeof(emf_mailbox_t));
                if (msg_s->mbox == NULL)
@@ -103,7 +76,7 @@ int  email_create_message(email_h *msg)
                        LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mbox", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                        free(msg_s);
                        return EMAIL_ERROR_OUT_OF_MEMORY;
-                       }
+               }
                
        
        }
@@ -111,79 +84,70 @@ int  email_create_message(email_h *msg)
        {
                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                return EMAIL_ERROR_OUT_OF_MEMORY;
-               }
+       }
 
                
        //return error from F/W 
        //EMF_ERROR_INVALID_PARAM/EMF_ERROR_NONE/EMF_ERROR_DB_FAILURE/EMF_ERROR_ACCOUNT_NOT_FOUND/EMF_ERROR_OUT_OF_MEMORY
-       ret=email_get_account_list(&account, &cnt);
-       
+       int default_account_id = 0;
+       if (!(ret = email_load_default_account_id(&default_account_id))) {
+               LOGE("[%s] email_load_default_account_id failed : [%d]",__FUNCTION__, ret);
+               return CONVERT_ERROR(ret);
+       }
        
-       if(ret!=EMF_ERROR_NONE) return _email_error_converter(ret);
+       ret = email_get_account(default_account_id, GET_FULL_DATA, &account);
+       if(ret!=EMF_ERROR_NONE) return CONVERT_ERROR(ret);
 
-       for(i=0;i<cnt;i++)
-       {
-               LOGD_IF(DBG_MODE,"account address[%d]= %s",i,account[i].email_addr);
-               LOGD_IF(DBG_MODE,"account id[%d]= %d",i,account[i].account_id);
-               LOGD_IF(DBG_MODE,"account name[%d]= %s",i,account[i].account_name);
-               LOGD_IF(DBG_MODE,"account user_name[%d]= %s",i,account[i].user_name);
-
-               }
+       LOGD_IF(DBG_MODE,"account address = %s",account->email_addr);
+       LOGD_IF(DBG_MODE,"account id = %d",account->account_id);
+       LOGD_IF(DBG_MODE,"account name = %s",account->account_name);
+       LOGD_IF(DBG_MODE,"account user_name = %s",account->user_name);
 
        emf_mailbox_t* mailbox_list = NULL;
        int sync_type =1;
-       email_get_mailbox_list(account[0].account_id, sync_type, &mailbox_list, &cnt);
-
-       
-       msg_s->mail->head->from = (char *)calloc(1,sizeof(char)*(strlen(account[0].user_name)+strlen(account[0].email_addr)+1+1+1+1+1));//"++"+<+ address +> + NULL
-       len= (strlen(account[0].user_name)+strlen(account[0].email_addr)+1+1+1+1+1);
-       char *strfrom = msg_s->mail->head->from;
-
-       snprintf(strfrom,len,"%s%s%s%s%s%s","\"",account[0].user_name,"\"","<",account[0].email_addr,">");
+       email_get_mailbox_list(account->account_id, sync_type, &mailbox_list, &cnt);
 
-
-       //info
-       emf_mail_info_t *info = msg_s->mail->info;
-       info->account_id = account[0].account_id;
-       info->flags.draft = 1;
        
-       //set flag1 as seen
-       info->flags.seen = 1;
+       msg_s->mail->full_address_from = (char *)calloc(1,sizeof(char)*(strlen(account->user_name)+strlen(account->email_addr)+1+1+1+1+1));//"++"+<+ address +> + NULL
+       len= (strlen(account->user_name)+strlen(account->email_addr)+1+1+1+1+1);
+       char *strfrom = msg_s->mail->full_address_from;
 
-       info->extra_flags.priority = EMF_MAIL_PRIORITY_NORMAL;
+       snprintf(strfrom,len,"%s%s%s%s%s%s","\"",account->user_name,"\"","<",account->email_addr,">");
 
        //mbox
        emf_mailbox_t * mbox =msg_s->mbox;
-       
-
        mbox->name  = (char *)calloc(1,sizeof(char)*strlen("OUTBOX")+1);
-
        if(mbox->name ==NULL){
                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create mbox->name", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                return EMAIL_ERROR_OUT_OF_MEMORY;
-               }
+       }
        
        len = strlen("OUTBOX")+1;
        snprintf(mbox->name,len,"%s","OUTBOX");
        mbox->mailbox_type = EMF_MAILBOX_TYPE_OUTBOX;
-       
-
        mbox->alias  = (char *)calloc(1,sizeof(char)*strlen("Outbox")+1);
-
        if(mbox->alias ==NULL){
                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create mbox->alias", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                return EMAIL_ERROR_OUT_OF_MEMORY;
-               }
+       }
        
        len = strlen("Outbox")+1;
        snprintf(mbox->alias,len,"%s","Outbox");
        
        mbox->local = 1;
        mbox->synchronous = 1;
-       mbox->account_id = account[0].account_id;
+       mbox->account_id = account->account_id;
        mbox->next = NULL;
        mbox->mail_slot_size = 50;
-       
+
+       //info
+       msg_s->mail->account_id = account->account_id;
+       msg_s->mail->flags_draft_field = 1;
+       msg_s->mail->flags_seen_field = 1;
+       msg_s->mail->priority = EMF_MAIL_PRIORITY_NORMAL;
+       msg_s->mail->mailbox_name = strdup(mbox->name);
+       msg_s->mail->mailbox_type = mbox->mailbox_type;
+       msg_s->mail->attachment_count = 0;
 
        *msg = (email_h)msg_s;
        return EMAIL_ERROR_NONE;
@@ -201,23 +165,13 @@ int email_destroy_message(email_h msg)
                
        email_s* msg_s = (email_s* )msg;
 
-       if(msg_s )
+       if(msg_s)
        {
-               if(msg_s->mail)
-               {
-                       if(msg_s->mail->head)free(msg_s->mail->head);
-
-                       if(msg_s->mail->body)
-                       {
-                               if(msg_s->mail->body->plain)remove(msg_s->mail->body->plain);                           
-                               free(msg_s->mail->body);
-                       }
-
-                       if(msg_s->mail->info)free(msg_s->mail->info);
-                       free(msg_s->mail);
-               }
+               if (msg_s->mail)
+                       email_free_mail_data(&msg_s->mail, 1);
 
-               if(msg_s->mbox)free(msg_s->mbox);
+               if (msg_s->mbox)
+                       email_free_mailbox(&msg_s->mbox, 1);
 
                free(msg_s);            
        }
@@ -245,16 +199,16 @@ int email_set_subject (email_h msg, const char *subject)
                
        email_s* msg_s = (email_s* )msg;        
 
-       msg_s->mail->head->subject=(char*)calloc(1,sizeof(char)*strlen(subject)+1);
+       msg_s->mail->subject=(char*)calloc(1,sizeof(char)*strlen(subject)+1);
 
-       if(msg_s->mail->head->subject ==NULL)
+       if(msg_s->mail->subject ==NULL)
        {
                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create msg_s->mail->head->subject", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                return EMAIL_ERROR_OUT_OF_MEMORY;
                }
        
        len =strlen(subject)+1;
-       snprintf(msg_s->mail->head->subject ,len,"%s",subject); 
+       snprintf(msg_s->mail->subject ,len,"%s",subject); 
        
        return EMAIL_ERROR_NONE;
 }
@@ -263,11 +217,11 @@ int email_set_body (email_h msg, const char *body)
 {
        int len;
 
-       if(msg ==NULL)
+       if (msg == NULL)
        {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg is null.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }
+       }
        
        email_s* msg_s = (email_s* )msg;        
 
@@ -275,221 +229,157 @@ int email_set_body (email_h msg, const char *body)
        FILE* file = NULL;
 
        
-       file= fopen("/tmp/capimail.txt", "w");
+    file = fopen("/tmp/capimail.txt", "w");
 
-       if(file !=NULL)
+       if (file != NULL)
        {
-                fputs(body,file);
+                fputs(body, file);
                 fclose(file);
-       }else
-       {
+       } else {
                LOGE("[%s] OPERATION_FAILED(0x%08x) : opening file for email body failed.", __FUNCTION__, EMAIL_ERROR_OPERATION_FAILED);
                return EMAIL_ERROR_OPERATION_FAILED;
        }
 
+       msg_s->mail->file_path_plain =(char *)calloc(1,sizeof(char)*strlen("/tmp/capimail.txt")+1);
 
-
-       msg_s->mail->body->plain =(char *)calloc(1,sizeof(char)*strlen("/tmp/capimail.txt")+1);
-
-       if(msg_s->mail->body->plain==NULL) {
+       if(msg_s->mail->file_path_plain == NULL) {
                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to allocate body(plain).", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                return EMAIL_ERROR_OUT_OF_MEMORY;
        }
        
        len =strlen("/tmp/capimail.txt")+1;
-       snprintf(msg_s->mail->body->plain,len,"%s","/tmp/capimail.txt");
+       snprintf(msg_s->mail->file_path_plain,len,"%s","/tmp/capimail.txt");
        
        return EMAIL_ERROR_NONE;
 }
 
  
 
-int email_add_recipient (email_h msg, email_recipient_type_e type,const char *address)
+int email_add_recipient (email_h msg, email_recipient_type_e type, const char *address)
 {
-       
-
-       char *tmp,*tmp1;
+       char *tmp;
        int total_len,in_len,pre_len,len;
 
-       if(msg ==NULL || type<EMAIL_RECIPIENT_TYPE_TO ||type>EMAIL_RECIPIENT_TYPE_BCC )
+       if(msg == NULL || type < EMAIL_RECIPIENT_TYPE_TO || type > EMAIL_RECIPIENT_TYPE_BCC )
+       {
                return EMAIL_ERROR_INVALID_PARAMETER;
-               
+       }
        
        email_s* msg_s = (email_s* )msg;
-       emf_mail_head_t *head = msg_s->mail->head;
        
-       if(strlen(address)>MAX_RECIPIENT_ADDRESS_LEN)
+       if(strlen(address) > MAX_RECIPIENT_ADDRESS_LEN)
        {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : The length of address should be less than 234.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }
+       }
 
        if(type == EMAIL_RECIPIENT_TYPE_TO)
        {
-               if(head->to==NULL)
+               if(msg_s->mail->full_address_to == NULL)
                {
-                       head->to = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
-                       if(head->to==NULL)
+                       msg_s->mail->full_address_to = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
+                       if(msg_s->mail->full_address_to == NULL)
                        {
                                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->to.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                                return EMAIL_ERROR_OUT_OF_MEMORY;
-                               }
+                       }
                        len =strlen(address)+2+1+1;
-                       snprintf(head->to,len,"%s%s%s","<",address,">");
-               }
-               else{
-
+                       snprintf(msg_s->mail->full_address_to,len,"%s%s%s","<",address,">");
+               } else {
                        in_len = strlen(address);
-                       pre_len = strlen(head->to);
+                       pre_len = strlen(msg_s->mail->full_address_to);
                        total_len = pre_len+in_len+3+1;// length of ",<>" + NULL
-                       tmp=(char*)calloc(1,sizeof(char)*total_len);
-
-                       //remove ';'
-                       tmp1 =(char*)calloc(1,sizeof(char)*pre_len+1);
-                       if(tmp1)
-                       {
-                               strncpy(tmp1,head->to,pre_len-1);
-                               tmp1[pre_len]='\0';
-                               }
-                       else
-                       {
-                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
-                               if(tmp)free(tmp);
-                               return EMAIL_ERROR_OUT_OF_MEMORY;
-                               }
 
                        //add new address
-                       free(head->to);
-                       head->to = (char*)calloc(1,sizeof(char)*total_len);
-                       len = total_len;
-                       snprintf(head->to,len,"%s%s%s%s",tmp1,"<",address,">");
-                       
-                       if(tmp)free(tmp);
-                       if(tmp1)free(tmp1);
-                       
+                       tmp = msg_s->mail->full_address_to;
+                       msg_s->mail->full_address_to = (char*)calloc(1,sizeof(char)*total_len);
+                       snprintf(msg_s->mail->full_address_to,total_len,"%s%s%s%s",tmp,",<",address,">");
+                       free(tmp);
                }
                
        }
        else if(type == EMAIL_RECIPIENT_TYPE_CC)//MESSAGING_RECIPIENT_TYPE_CC
        {
-               if(head->cc==NULL)
+               if(msg_s->mail->full_address_cc == NULL)
                {
-                       head->cc = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
-                       if(head->cc==NULL)
+                       msg_s->mail->full_address_cc = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
+                       if(msg_s->mail->full_address_cc == NULL)
                        {
                                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->cc.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                                return EMAIL_ERROR_OUT_OF_MEMORY;
-                               }
+                       }
                        len =strlen(address)+2+1+1;
-                       snprintf(head->cc,len,"%s%s%s","<",address,">");
-               }
-               else{
+                       snprintf(msg_s->mail->full_address_cc,len,"%s%s%s","<",address,">");
+               } else {
 
                        in_len = strlen(address);
-                       pre_len = strlen(head->cc);
+                       pre_len = strlen(msg_s->mail->full_address_cc);
                        total_len = pre_len+in_len+3+1;// length of ",<>" + NULL
-                       tmp=(char*)calloc(1,sizeof(char)*total_len);
-
-                       //remove ';'
-                       tmp1 =(char*)calloc(1,sizeof(char)*pre_len+1);
-                       if(tmp1)
-                       {
-                               strncpy(tmp1,head->cc,pre_len-1);
-                               tmp1[pre_len]='\0';
-                               }
-                       else{
-                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
-                               if(tmp)free(tmp);
-                               return EMAIL_ERROR_OUT_OF_MEMORY;
-                       }
 
                        //add new address
-                       free(head->cc);
-                       head->cc = (char*)calloc(1,sizeof(char)*total_len);
-                       len = total_len;
-                       snprintf(head->cc,len,"%s%s%s%s",tmp1,"<",address,">"); 
-
-                       if(tmp)free(tmp);
-                       if(tmp1)free(tmp1);
+                       tmp = msg_s->mail->full_address_cc;
+                       msg_s->mail->full_address_cc = (char*)calloc(1,sizeof(char)*total_len);
+                       snprintf(msg_s->mail->full_address_cc,total_len,"%s%s%s%s",tmp,",<",address,">");
+                       free(tmp);
                }
                
        }
        else //MESSAGING_RECIPIENT_TYPE_BCC
        {
-               if(head->bcc==NULL)
+               if(msg_s->mail->full_address_bcc == NULL)
                {
-                       head->bcc = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
-                       if(head->bcc==NULL)
+                       msg_s->mail->full_address_bcc = (char*)calloc(1,sizeof(char)*strlen(address)+2+1+1);//<>+;+end of string
+                       if(msg_s->mail->full_address_bcc==NULL)
                        {
                                LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create head->bcc.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
                                return EMAIL_ERROR_OUT_OF_MEMORY;
-                               }
+                       }
                        len =strlen(address)+2+1+1;
-                       snprintf(head->bcc,len,"%s%s%s","<",address,">");
+                       snprintf(msg_s->mail->full_address_bcc,len,"%s%s%s","<",address,">");
                }
                else{
 
                        in_len = strlen(address);
-                       pre_len = strlen(head->bcc);
+                       pre_len = strlen(msg_s->mail->full_address_bcc);
                        total_len = pre_len+in_len+3+1;// length of ",<>" + NULL
-                       tmp=(char*)calloc(1,sizeof(char)*total_len);
-
-                       //remove ';'
-                       tmp1 =(char*)calloc(1,sizeof(char)*pre_len+1);
-                       if(tmp1)
-                       {
-                               strncpy(tmp1,head->bcc,pre_len-1);
-                               tmp1[pre_len]='\0';
-                               }
-                       else{
-                               LOGE("[%s] OUT_OF_MEMORY(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY);
-                               if(tmp)free(tmp);
-                               return EMAIL_ERROR_OUT_OF_MEMORY;
-                               }
 
                        //add new address
-                       free(head->bcc);
-                       head->bcc = (char*)calloc(1,sizeof(char)*total_len);
-                       len = total_len;
-                       snprintf(head->bcc,len,"%s%s%s%s",tmp1,"<",address,">"); 
-
-                       if(tmp)free(tmp);
-                       if(tmp1)free(tmp1);
+                       tmp = msg_s->mail->full_address_bcc;
+                       msg_s->mail->full_address_bcc = (char*)calloc(1,sizeof(char)*total_len);
+                       snprintf(msg_s->mail->full_address_bcc,total_len,"%s%s%s%s",tmp,",<",address,">");
+                       free(tmp);
                }
        }
 
-       
-
        return EMAIL_ERROR_NONE;
 }
 
-int email_remove_all_recipients (email_h msg)
+int email_remove_all_recipients(email_h msg)
 {
        if(msg ==NULL)
        {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : fail to create tmp memory.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }
+       }
        
-       email_s* msg_s = (email_s* )msg;
+       email_s *msg_s = (email_s *)msg;
 
-       emf_mail_head_t *head = msg_s->mail->head;
-       if(head->to !=NULL)
+       if(msg_s->mail->full_address_to != NULL)
        {
-               free(head->to);
-               head->to = NULL;
+               free(msg_s->mail->full_address_to);
+               msg_s->mail->full_address_to = NULL;
        }
 
-       if(head->cc !=NULL)
+       if(msg_s->mail->full_address_cc != NULL)
        {
-               free(head->cc);
-               head->cc = NULL;
+               free(msg_s->mail->full_address_cc);
+               msg_s->mail->full_address_cc = NULL;
        }
 
-       if(head->bcc !=NULL)
+       if(msg_s->mail->full_address_bcc != NULL)
        {
-               free(head->bcc);
-               head->bcc = NULL;
+               free(msg_s->mail->full_address_bcc);
+               msg_s->mail->full_address_bcc = NULL;
        }
        return EMAIL_ERROR_NONE;
 }
@@ -497,76 +387,61 @@ int email_remove_all_recipients (email_h msg)
 
 int email_add_attach (email_h msg, const char *filepath)
 {
-       int i,len;
+       int len;
        char *pos,*last;
        struct stat st;
-       
 
-       if(msg ==NULL ||filepath == NULL)
+       if(msg ==NULL || filepath == NULL)
        {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg or filepath is null.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }
-               
-       email_s* msg_s = (email_s* )msg;
-
-       emf_attachment_info_t*  new_attach,* tmp_attach;
-       emf_mail_body_t* body = msg_s->mail->body;      
+       }
 
+       email_s *msg_s = (email_s *)msg;
 
-       stat(filepath,&st);
+       int attachment_count = msg_s->mail->attachment_count;
+       emf_attachment_data_t *new_attach = msg_s->attachment;
 
+       stat(filepath, &st);
        if(st.st_size > 10*1024*1024)
        {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : the size of attachment file is beyond the limit(MAX:10M).", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }
-       
-       new_attach =(emf_attachment_info_t *)calloc(1,sizeof(emf_attachment_info_t));
-
+       }
 
-       pos=strpbrk(filepath,"//");
+       if (!S_ISREG(st.st_mode))
+       {
+               LOGE("[%s] INVALID_PARAMETER(0x%08x) : the filepath is not regular file.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
+               return EMAIL_ERROR_INVALID_PARAMETER;
+       }
+               
 
+       pos=strpbrk(filepath, "//");
        len =strlen(filepath); 
-       
-       if(pos==NULL)
+       if(pos == NULL)
        {
-               new_attach->name =(char*)calloc(1,sizeof(char)*len+1);
-               snprintf(new_attach->name,len+1,"%s",filepath); 
-               }
+               new_attach[attachment_count].attachment_name = (char*)calloc(1,sizeof(char)*len+1);
+               snprintf(new_attach[attachment_count].attachment_name,len+1,"%s",filepath); 
+       }
        else
        {
-               while(pos!=NULL)
+               while(pos != NULL)
                {
                        last=pos;
                        pos=strpbrk(pos,"//");  
-                       if(pos!=NULL)pos++;
-                       }
-               
-               new_attach->name =last;
-               
+                       if(pos != NULL) pos++;
                }
-       new_attach->savename =(char*)calloc(1,sizeof(char)*len+1);
-       
-       if(new_attach->savename==NULL)return EMAIL_ERROR_OUT_OF_MEMORY;
-       
-       snprintf(new_attach->savename,len+1,"%s",filepath); 
-       new_attach->size = st.st_size;
-       new_attach->downloaded = 1;
 
-       if(body->attachment_num ==0){
-
-               body->attachment = new_attach;
-       }       
-       else{
-               tmp_attach = body->attachment;
-               for (i=0; i < body->attachment_num -1; i++) {
-                       tmp_attach = tmp_attach->next;
-               }
-               tmp_attach->next = new_attach;
+               new_attach[attachment_count].attachment_name =last;
        }
+       new_attach[attachment_count].attachment_path =(char*)calloc(1,sizeof(char)*len+1);
+       if (new_attach[attachment_count].attachment_path == NULL) return EMAIL_ERROR_OUT_OF_MEMORY;
+
+       snprintf(new_attach[attachment_count].attachment_path, len+1, "%s", filepath); 
+       new_attach[attachment_count].attachment_size = st.st_size;
+       new_attach[attachment_count].save_status = 1;
 
-       body->attachment_num ++;
+       msg_s->mail->attachment_count++;
 
        return EMAIL_ERROR_NONE;
 
@@ -574,17 +449,15 @@ int email_add_attach (email_h msg, const char *filepath)
 
 int email_remove_all_attachments (email_h msg)
 {
-       if(msg ==NULL)
-       {
+       if (msg ==NULL) {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg is null.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }       
+       }
+
        email_s* msg_s = (email_s* )msg;
-       emf_mail_body_t* body = msg_s->mail->body;
-       if(body->attachment != NULL)
-       {
-               free(body->attachment);
-               }
+
+       msg_s->mail->attachment_count = 0;
+
        return EMAIL_ERROR_NONE;
 }
 
@@ -594,70 +467,61 @@ int email_send_message (email_h msg)
        int i, ret;
        emf_option_t option;
        unsigned  handle;
-       emf_attachment_info_t *tmp_attach;
+       emf_attachment_data_t *tmp_attach = NULL;
+       struct tm *struct_time;
 
-       if(msg ==NULL )
-       {
+       if (msg == NULL) {
                LOGE("[%s] INVALID_PARAMETER(0x%08x) : msg is null.", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER);
                return EMAIL_ERROR_INVALID_PARAMETER;
-               }       
-               
-       email_s* msg_s = (email_s* )msg;
+       }       
 
+       email_s *msg_s = (email_s *)msg;
        
        {
                /*--------- head ----------*/
                LOGD_IF(DBG_MODE, " ----------head---------");
-               LOGD_IF(DBG_MODE, "  mid: %s\n",msg_s->mail->head->mid);
-               LOGD_IF(DBG_MODE, "  subject: %s\n",msg_s->mail->head->subject);
-               LOGD_IF(DBG_MODE, "  to: %s\n",msg_s->mail->head->to);
-               LOGD_IF(DBG_MODE, "  from: %s\n",msg_s->mail->head->from);
-               LOGD_IF(DBG_MODE, "  cc: %s\n",msg_s->mail->head->cc);
-               LOGD_IF(DBG_MODE, "  bcc: %s\n",msg_s->mail->head->bcc);
-               LOGD_IF(DBG_MODE, "  reply_to: %s\n",msg_s->mail->head->reply_to);
-               LOGD_IF(DBG_MODE, "  return_path: %s\n",msg_s->mail->head->return_path);
-               LOGD_IF(DBG_MODE, "  from_contact_name: %s\n",msg_s->mail->head->from_contact_name);
-               LOGD_IF(DBG_MODE, "  to_contact_name: %s\n",msg_s->mail->head->to_contact_name);
-               LOGD_IF(DBG_MODE, "  cc_contact_name: %s\n",msg_s->mail->head->cc_contact_name);
-               LOGD_IF(DBG_MODE, "  bcc_contact_name: %s\n",msg_s->mail->head->bcc_contact_name);
-               LOGD_IF(DBG_MODE, "  previewBodyText: %s\n",msg_s->mail->head->previewBodyText);
-
-               LOGD_IF(DBG_MODE, "  year: %d\n",msg_s->mail->head->datetime.year);
-               LOGD_IF(DBG_MODE, "  month: %d\n",msg_s->mail->head->datetime.month);
-               LOGD_IF(DBG_MODE, "  day: %d\n",msg_s->mail->head->datetime.day);
-               LOGD_IF(DBG_MODE, "  hour: %d\n",msg_s->mail->head->datetime.hour);
-               LOGD_IF(DBG_MODE, "  minute: %d\n",msg_s->mail->head->datetime.minute);
-               LOGD_IF(DBG_MODE, "  second: %d\n",msg_s->mail->head->datetime.second);
+               LOGD_IF(DBG_MODE, "  mid: %s\n",msg_s->mail->message_id);
+               LOGD_IF(DBG_MODE, "  subject: %s\n",msg_s->mail->subject);
+               LOGD_IF(DBG_MODE, "  to: %s\n",msg_s->mail->full_address_to);
+               LOGD_IF(DBG_MODE, "  from: %s\n",msg_s->mail->full_address_from);
+               LOGD_IF(DBG_MODE, "  cc: %s\n",msg_s->mail->full_address_cc);
+               LOGD_IF(DBG_MODE, "  bcc: %s\n",msg_s->mail->full_address_bcc);
+               LOGD_IF(DBG_MODE, "  reply_to: %s\n",msg_s->mail->full_address_reply);
+               LOGD_IF(DBG_MODE, "  return_path: %s\n",msg_s->mail->full_address_return);
+               LOGD_IF(DBG_MODE, "  previewBodyText: %s\n",msg_s->mail->preview_text);
+
+               struct_time = localtime(&msg_s->mail->date_time);
+
+               LOGD_IF(DBG_MODE, "  %4d year\n", struct_time->tm_year+1900);
+               LOGD_IF(DBG_MODE, "  %2d month\n", struct_time->tm_mon+1);
+               LOGD_IF(DBG_MODE, "  %2d day\n", struct_time->tm_mday);
+               LOGD_IF(DBG_MODE, "  %2d:%2d:%2d \n", struct_time->tm_hour, struct_time->tm_min, struct_time->tm_sec);
 
                /*--------- body ----------*/
                LOGD_IF(DBG_MODE, " ----------body---------");
                LOGD_IF(DBG_MODE, "  body\n");
-               LOGD_IF(DBG_MODE, "  plain: %s\n",msg_s->mail->body->plain);
-               LOGD_IF(DBG_MODE, "  plain_charset: %s\n",msg_s->mail->body->plain_charset);
-               LOGD_IF(DBG_MODE, "  html: %s\n",msg_s->mail->body->html);
-               LOGD_IF(DBG_MODE, "  attachment_num: %d\n",msg_s->mail->body->attachment_num);
-               tmp_attach = msg_s->mail->body->attachment;
-               for (i=0; i < msg_s->mail->body->attachment_num; i++) {
+               LOGD_IF(DBG_MODE, "  plain: %s\n",msg_s->mail->file_path_plain);
+               LOGD_IF(DBG_MODE, "  html: %s\n",msg_s->mail->file_path_html);
+               LOGD_IF(DBG_MODE, "  attachment_num: %d\n",msg_s->mail->attachment_count);
+               tmp_attach = msg_s->attachment;
+               for (i=0; i < msg_s->mail->attachment_count; i++) {
                        LOGD_IF(DBG_MODE, " ----------attachment[%d]---------", i+1);
-                       LOGD_IF(DBG_MODE, "  name: %s\n",tmp_attach->name);
-                       LOGD_IF(DBG_MODE, "  savename: %s\n",tmp_attach->savename);
-                       LOGD_IF(DBG_MODE, "  downloaded: %d\n",tmp_attach->downloaded);
-                       LOGD_IF(DBG_MODE, "  size: %d\n",tmp_attach->size);
-                       tmp_attach = tmp_attach->next;
-                       
+                       LOGD_IF(DBG_MODE, "  name: %s\n",tmp_attach[i].attachment_name);
+                       LOGD_IF(DBG_MODE, "  savename: %s\n",tmp_attach[i].attachment_path);
+                       LOGD_IF(DBG_MODE, "  downloaded: %d\n",tmp_attach[i].save_status);
+                       LOGD_IF(DBG_MODE, "  size: %d\n",tmp_attach[i].attachment_size);
                }               
        }
 
        {
                        /*--------- info ----------*/
                LOGD_IF(DBG_MODE, " ----------info---------");
-               LOGD_IF(DBG_MODE, "  emf_mail_info_t \n");
-               LOGD_IF(DBG_MODE, "  account_id: %d\n",msg_s->mail->info->account_id);
-               LOGD_IF(DBG_MODE, "  uid: %d\n",msg_s->mail->info->uid);
-               LOGD_IF(DBG_MODE, "  rfc822_size: %d\n",msg_s->mail->info->rfc822_size);
-               LOGD_IF(DBG_MODE, "  body_downloaded: %d\n",msg_s->mail->info->body_downloaded);
-               LOGD_IF(DBG_MODE, "  sid: %s\n",msg_s->mail->info->sid);
-               LOGD_IF(DBG_MODE, "   is_meeting_request: %d\n",msg_s->mail->info->is_meeting_request); 
+               LOGD_IF(DBG_MODE, "  account_id: %d\n",msg_s->mail->account_id);
+               LOGD_IF(DBG_MODE, "  mail_id: %d\n",msg_s->mail->mail_id);
+               LOGD_IF(DBG_MODE, "  mail_size: %d\n",msg_s->mail->mail_size);
+               LOGD_IF(DBG_MODE, "  body_download_status: %d\n",msg_s->mail->body_download_status);
+               LOGD_IF(DBG_MODE, "  server_id: %s\n",msg_s->mail->server_mail_id);
+               LOGD_IF(DBG_MODE, "  meeting_request_status: %d\n",msg_s->mail->meeting_request_status);        
        }
 
        
@@ -681,16 +545,15 @@ int email_send_message (email_h msg)
        }
 
 
-       ret=email_add_message(msg_s->mail, msg_s->mbox, 1);
-
-       ret=_email_error_converter(ret);
+       ret=email_add_mail(msg_s->mail, msg_s->attachment, msg_s->mail->attachment_count, NULL, 0);
+       ret=CONVERT_ERROR(ret);
        
        option.keep_local_copy = 1;
 
-       ret=email_send_mail(msg_s->mbox, msg_s->mail->info->uid, &option, &handle);
+       ret=email_send_mail(msg_s->mbox, msg_s->mail->mail_id, &option, &handle);
 
 
-       ret=_email_error_converter(ret);
+       ret=CONVERT_ERROR(ret);
        _email_add_dbus_filter();
        return ret;
 }
@@ -712,7 +575,7 @@ email_cb_context * _email_search_callback_by_emailid(int mailid)
                                break;
                        
                        cbContext= (email_cb_context *)node->data; 
-                       if(cbContext->handle->mail->info->uid == mailid)
+                       if(cbContext->handle->mail->mail_id == mailid)
                        {
                                
                                        return cbContext;
@@ -806,43 +669,41 @@ int email_unset_message_sent_cb (email_h msg)
 
 }
 
-int _email_error_converter(int err)
+int _email_error_converter(int err, const char *func, int line)
 {
        switch(err) 
        {
-               
-
                case EMF_ERROR_INVALID_PARAM:
-                       LOGE("[%s] INVALID_PARAM(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_INVALID_PARAMETER, err);
+                       LOGE("[%s:%d] INVALID_PARAM(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_INVALID_PARAMETER, err);
                        return EMAIL_ERROR_INVALID_PARAMETER;
 
                case EMF_ERROR_DB_FAILURE:
-                       LOGE("[%s] DB_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_DB_FAILED, err);
+                       LOGE("[%s:%d] DB_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_DB_FAILED, err);
                        return EMAIL_ERROR_DB_FAILED;
 
                case EMF_ERROR_ACCOUNT_NOT_FOUND:
-                       LOGE("[%s] ACCOUNT_NOT_FOUND(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_ACCOUNT_NOT_FOUND,err);
+                       LOGE("[%s:%d] ACCOUNT_NOT_FOUND(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_ACCOUNT_NOT_FOUND,err);
                        return EMAIL_ERROR_ACCOUNT_NOT_FOUND;
 
                case EMF_ERROR_OUT_OF_MEMORY:
-                       LOGE("[%s] OUT_OF_MEMORY(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_OUT_OF_MEMORY,err);
+                       LOGE("[%s:%d] OUT_OF_MEMORY(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_OUT_OF_MEMORY,err);
                        return EMAIL_ERROR_OUT_OF_MEMORY;
                        
                // Tizen email F/W  is often using this error type when it gets a null value from server
                //It could be caused from server or IPC.
                case EMF_ERROR_NULL_VALUE: 
-                       LOGE("[%s] NULL_VALUE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED,err);
+                       LOGE("[%s:%d] NULL_VALUE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED,err);
                        return EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
 
                case EMF_ERROR_IPC_SOCKET_FAILURE:
-                       LOGE("[%s] IPC_SOCKET_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED,err);
+                       LOGE("[%s:%d] IPC_SOCKET_FAILURE(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED,err);
                        return EMAIL_ERROR_COMMUNICATION_WITH_SERVER_FAILED;
 
                case EMF_ERROR_NONE:
                        return EMAIL_ERROR_NONE;
 
                default:
-                       LOGE("[%s] OPERATION_FAILED(0x%08x) : Error from Email F/W. ret: (0x%08x) ", __FUNCTION__, EMAIL_ERROR_OPERATION_FAILED,err);
+                       LOGE("[%s:%d] OPERATION_FAILED(0x%08x) : Error from Email F/W. ret: (0x%08x) ", func, line, EMAIL_ERROR_OPERATION_FAILED,err);
                        return EMAIL_ERROR_OPERATION_FAILED;
 
        }