4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Kyuho Jo <kyuho.jo@samsung.com>, Sunghyun Kwon <sh0701.kwon@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
23 #ifndef __EMAIL_API_MAIL_H__
24 #define __EMAIL_API_MAIL_H__
26 #include "email-types.h"
30 #include <sys/types.h>
35 * @defgroup EMAIL_SERVICE Email Service
41 * @ingroup EMAIL_SERVICE
42 * @defgroup EMAIL_API_MAIL Email Mail API
48 * This file contains the data structures and interfaces needed for application,
49 * to interact with email-service.
50 * @file email-api-mail.h
51 * @author Kyuho Jo <kyuho.jo@samsung.com>
52 * @author Sunghyun Kwon <sh0701.kwon@samsung.com>
54 * @brief This file contains the data structures and interfaces of Messages provided by
62 #endif /* __cplusplus */
66 * @fn email_add_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_eas)
67 * @brief Save a mail. This function is invoked when user wants to add a mail.
68 * If the option from_eas is 1 then this will save the message on server as well as on locally.
69 * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_eas value will be 0
70 * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_eas value will be 1/0
72 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
73 * @param[in] input_mail_data Specifies the saving mail.
74 * @param[in] input_attachment_data_list Specifies the mailbox structure for saving email.
75 * @param[in] input_attachment_count Specifies if the mail comes from composer.
76 * @param[in] input_meeting_request Specifies if the mail comes from composer.
77 * @param[in] input_from_eas Specifies if the mail will be saved on server.
80 * @see email_mail_data_t and email_mailbox_t
83 * #include "email-api-mail.h"
84 * int _test_add_mail ()
89 * int attachment_count = 0;
90 * int err = EMAIL_ERROR_NONE;
91 * char arg[50] = { 0 , };
92 * char *body_file_path = "/opt/data/email/.emfdata/tmp/mail.txt";
93 * email_mailbox_t *mailbox_data = NULL;
94 * email_mail_data_t *test_mail_data = NULL;
95 * email_attachment_data_t *attachment_data = NULL;
96 * email_meeting_request_t *meeting_req = NULL;
99 * printf("\n > Enter account id : ");
100 * scanf("%d", &account_id);
103 * memset(arg, 0x00, 50);
104 * printf("\n > Enter mailbox name : ");
107 * email_get_mailbox_by_name(account_id, arg, &mailbox_data);
109 * test_mail_data = malloc(sizeof(email_mail_data_t));
110 * memset(test_mail_data, 0x00, sizeof(email_mail_data_t));
112 * printf("\n From EAS? [0/1]> ");
113 * scanf("%d", &from_eas);
115 * test_mail_data->account_id = account_id;
116 * test_mail_data->save_status = 1;
117 * test_mail_data->flags_seen_field = 1;
118 * test_mail_data->file_path_plain = strdup(body_file_path);
119 * test_mail_data->mailbox_id = mailbox_data->mailbox_id;
120 * test_mail_data->mailbox_type = mailbox_data->mailbox_type;
121 * test_mail_data->full_address_from = strdup("<test1@test.com>");
122 * test_mail_data->full_address_to = strdup("<test2@test.com>");
123 * test_mail_data->full_address_cc = strdup("<test3@test.com>");
124 * test_mail_data->full_address_bcc = strdup("<test4@test.com>");
125 * test_mail_data->subject = strdup("Meeting request mail");
127 * body_file = fopen(body_file_path, "w");
129 * for(i = 0; i < 500; i++)
130 * fprintf(body_file, "X2 X2 X2 X2 X2 X2 X2");
134 * printf(" > Attach file? [0/1] : ");
135 * scanf("%d",&attachment_count);
137 * if ( attachment_count ) {
138 * memset(arg, 0x00, 50);
139 * printf("\n > Enter attachment name : ");
142 * attachment_data = malloc(sizeof(email_attachment_data_t));
144 * attachment_data->attachment_name = strdup(arg);
146 * memset(arg, 0x00, 50);
147 * printf("\n > Enter attachment absolute path : ");
150 * attachment_data->attachment_path = strdup(arg);
151 * attachment_data->save_status = 1;
152 * test_mail_data->attachment_count = attachment_count;
155 * printf("\n > Meeting Request? [0: no, 1: yes (request from server), 2: yes (response from local)]");
156 * scanf("%d", &(test_mail_data->meeting_request_status));
158 * if ( test_mail_data->meeting_request_status == 1
159 * || test_mail_data->meeting_request_status == 2 ) {
160 * time_t current_time;
161 * meeting_req = malloc(sizeof(email_meeting_request_t));
162 * memset(meeting_req, 0x00, sizeof(email_meeting_request_t));
164 * meeting_req->meeting_response = 1;
165 * current_time = time(NULL);
166 * gmtime_r(¤t_time, &(meeting_req->start_time));
167 * gmtime_r(¤t_time, &(meeting_req->end_time));
168 * meeting_req->location = malloc(strlen("Seoul") + 1);
169 * memset(meeting_req->location, 0x00, strlen("Seoul") + 1);
170 * strcpy(meeting_req->location, "Seoul");
171 * strcpy(meeting_req->global_object_id, "abcdef12345");
173 * meeting_req->time_zone.offset_from_GMT = 9;
174 * strcpy(meeting_req->time_zone.standard_name, "STANDARD_NAME");
175 * gmtime_r(¤t_time, &(meeting_req->time_zone.standard_time_start_date));
176 * meeting_req->time_zone.standard_bias = 3;
178 * strcpy(meeting_req->time_zone.daylight_name, "DAYLIGHT_NAME");
179 * gmtime_r(¤t_time, &(meeting_req->time_zone.daylight_time_start_date));
180 * meeting_req->time_zone.daylight_bias = 7;
184 * if((err = email_add_mail(test_mail_data, attachment_data, attachment_count, meeting_req, from_eas)) != EMAIL_ERROR_NONE)
185 * printf("email_add_mail failed. [%d]\n", err);
187 * printf("email_add_mail success.\n");
189 * if(attachment_data)
190 * email_free_attachment_data(&attachment_data, attachment_count);
193 * email_free_meeting_request(&meeting_req, 1);
195 * email_free_mail_data(&test_mail_data, 1);
196 * email_free_mailbox(&mailbox_data, 1);
198 * printf("saved mail id = [%d]\n", test_mail_data->mail_id);
204 EXPORT_API int email_add_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_eas);
208 * @fn email_add_read_receipt(int input_read_mail_id, unsigned *output_handle)
209 * @brief Add a read receipt mail. This function is invoked when user receives a mail with read report enable and wants to send a read report for the same.
211 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
212 * @param[in] input_read_mail_id Specifies the id of mail which has been read.
213 * @param[out] output_receipt_mail_id Specifies the receipt mail id .
218 EXPORT_API int email_add_read_receipt(int input_read_mail_id, int *output_receipt_mail_id);
222 * @fn email_update_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_composer)
223 * @brief Update a existing email information. This function is invoked when user wants to change some existing email information with new email information.
225 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
226 * @param[in] input_mail_data Specifies the mail ID.
227 * @param[in] input_attachment_data_list Specifies the pointer of attachment data.
228 * @param[in] input_attachment_count Specifies the number of attachment data.
229 * @param[in] input_meeting_request Specifies the meeting request data.
230 * @param[in] input_from_eas Specifies whether sync server.
233 * @see email_mail_data_t
235 * #include "email-api-account.h"
236 * int email_test_update_mail()
239 * int err = EMAIL_ERROR_NONE;
240 * int test_attachment_data_count = 0;
242 * email_mail_data_t *test_mail_data = NULL;
243 * email_attachment_data_t *test_attachment_data_list = NULL;
244 * email_meeting_request_t *meeting_req = NULL;
246 * printf("\n > Enter mail id : ");
247 * scanf("%d", &mail_id);
249 * email_get_mail_data(mail_id, &test_mail_data);
251 * printf("\n > Enter Subject: ");
254 * test_mail_data->subject= strdup(arg);
258 * if (test_mail_data->attachment_count > 0) {
259 * if ( (err = email_get_attachment_data_list(mail_id, &test_attachment_data_list, &test_attachment_data_count)) != EMAIL_ERROR_NONE ) {
260 * printf("email_get_meeting_request() failed [%d]\n", err);
265 * if ( test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_REQUEST
266 * || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_RESPONSE
267 * || test_mail_data->meeting_request_status == EMAIL_MAIL_TYPE_MEETING_ORIGINATINGREQUEST) {
269 * if ( (err = email_get_meeting_request(mail_id, &meeting_req)) != EMAIL_ERROR_NONE ) {
270 * printf("email_get_meeting_request() failed [%d]\n", err);
274 * printf("\n > Enter meeting response: ");
275 * scanf("%d", (int*)&(meeting_req->meeting_response));
278 * if ( (err = email_update_mail(test_mail_data, test_attachment_data_list, test_attachment_data_count, meeting_req, 0)) != EMAIL_ERROR_NONE)
279 * printf("email_update_mail failed.[%d]\n", err);
281 * printf("email_update_mail success\n");
284 * email_free_mail_data(&test_mail_data, 1);
286 * if(test_attachment_data_list)
287 * email_free_attachment_data(&test_attachment_data_list, test_attachment_data_count);
290 * email_free_meeting_request(&meeting_req, 1);
298 EXPORT_API int email_update_mail(email_mail_data_t *input_mail_data, email_attachment_data_t *input_attachment_data_list, int input_attachment_count, email_meeting_request_t* input_meeting_request, int input_from_eas);
302 * @fn email_count_mail(email_mailbox_t* mailbox, int* total, int* unseen)
303 * @brief Get mail count from mailbox.This function is invoked when user wants to know how many toatl mails and out of that
304 * how many unseen mails are there in a given mailbox.
306 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
307 * @param[in] mailbox Specifies the pointer of mailbox structure.
308 * @param[out] total Total email count is saved here.
309 * @param[out] unseen Unread email count is saved here.
311 * @see email_mailbox_t
314 * #include "email-api-account.h"
316 * _api_sample_count_mail()
320 * email_list_filter_t *filter_list = NULL;
321 * int err = EMAIL_ERROR_NONE;
323 * filter_list = malloc(sizeof(email_list_filter_t) * 3);
324 * memset(filter_list, 0 , sizeof(email_list_filter_t) * 3);
326 * filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
327 * filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
328 * filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
329 * filter_list[0].list_filter_item.rule.key_value.string_type_value = strdup("RE");
330 * filter_list[0].list_filter_item.rule.case_sensitivity = false;
332 * filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
333 * filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
335 * filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
336 * filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_TO;
337 * filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
338 * filter_list[2].list_filter_item.rule.key_value.string_type_value = strdup("RE");
339 * filter_list[2].list_filter_item.rule.case_sensitivity = false;
341 * if(EMAIL_ERROR_NONE == email_count_mail(filter_list, 3, &total, &unseen))
342 * printf("\n Total: %d, Unseen: %d \n", total, unseen);
347 EXPORT_API int email_count_mail(email_list_filter_t *input_filter_list, int input_filter_count, int *output_total_mail_count, int *output_unseen_mail_count);
351 * @fn email_get_max_mail_count(int *Count)
352 * @brief Gets the max count of mails which can be supported by email-service
354 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
355 * @param[out] Count max count of mails which can be supported by email-service
358 * #include "email-api-account.h"
360 * _api_sample_get_max_mail_count()
362 * int max_count = -1;
364 * if(EMAIL_ERROR_NONE == email_get_max_mail_count(&max_count))
365 * printf("\n\t>>>>> email_get_max_mail_count() return [%d]\n\n", max_count);
370 EXPORT_API int email_get_max_mail_count(int *count);
374 * @fn email_delete_mail(email_mailbox_t* mailbox, int *mail_ids, int num, int from_server)
375 * @brief Delete a mail or multiple mails.Based on from_server value this function will delte a mail or multiple mails from server or loaclly.
376 * @param[in] mailbox Reserved.
377 * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0
378 * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0
380 * @param[in] mail_ids[] Specifies the arrary of mail id.
381 * @param[in] num Specifies the number of mail id.
382 * @param[in] from_server Specifies whether mails are deleted from server.
383 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
385 * @see email_mailbox_t
387 * #include "email-api-account.h"
389 * _api_sample_delete_mail()
391 * int count, i, mail_id=0, mailbox_id =0;
393 * printf("\n > Enter Mail_id: ");
394 * scanf("%d",&mail_id);
395 * printf("\n > Enter Mailbox ID: ");
396 * scanf("%d",&mailbox_id);
397 * if(EMAIL_ERROR_NONE == email_delete_mail(mailbox_id, &mail_id, 1, 1))
398 * printf("\n email_delete_mail success");
400 * printf("\n email_delete_mail failed");
405 EXPORT_API int email_delete_mail(int input_mailbox_id, int *input_mail_ids, int input_num, int input_from_server);
410 * @fn email_delete_all_mails_in_mailbox(int input_mailbox_id, int input_from_server)
411 * @brief Delete all mail from a mailbox.
412 * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0
413 * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0
415 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
416 * @param[in] mailbox Specifies the structure of mailbox.
417 * @param[in] from_server Specifies whether mails are also deleted from server.
419 * @see email_mailbox_t
422 * #include "email-api-account.h"
424 * _api_sample_delete_all_mails_in_mailbox()
426 * int count, mailbox_id =0;
428 * printf("\n > Enter mailbox_id: ");
429 * scanf("%d",&mailbox_id);
431 * if (EMAIL_ERROR_NONE != email_delete_all_mails_in_mailbox(mailbox_id, 0))
432 * printf("email_delete_all_mails_in_mailbox failed");
434 * printf("email_delete_all_mails_in_mailbox Success");
439 EXPORT_API int email_delete_all_mails_in_mailbox(int input_mailbox_id, int input_from_server);
443 * @fn email_clear_mail_data()
444 * @brief delete email data from storage. This API will be used by the Settings Application
446 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
451 * #include "email-api-account.h"
453 * _api_sample_clear_mail_data()
455 * if(EMAIL_ERROR_NONE == email_clear_mail_data())
464 EXPORT_API int email_clear_mail_data();
469 * @fn email_add_attachment(int mail_id, email_attachment_data_t* attachment)
470 * @brief Append a attachment to email.This function is invoked when user wants to add attachment to existing mail.
472 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
473 * @param[in] mail_id Specifies the mail ID.
474 * @param[in] attachment Specifies the structure of attachment.
476 * @see email_attachment_data_t
479 * #include "email-api-account.h"
481 * _api_sample_mail_add_attachment()
484 * email_attachment_data_t attachment;
486 * printf("\n > Enter Mail Id: ");
487 * scanf("%d", &mail_id);
488 * memset(&attachment, 0x00, sizeof(email_attachment_data_t));
489 * printf("\n > Enter attachment name: ");
490 * attachment.name = strdup("Test");
491 * printf("\n > Enter attachment absolute path: ");
492 * attachment.savename = strdup("/tmp/test.txt");
493 * attachment.next = NULL;
494 * if(EMAIL_ERROR_NONE != email_add_attachment(mail_id, &attachment))
495 * printf("email_add_attachment failed\n");
497 * printf(email_add_attachment success\n");
502 EXPORT_API int email_add_attachment(int mail_id, email_attachment_data_t* attachment);
507 * @fn email_delete_attachment(int mail_id, const char * attachment_id)
508 * @brief delete a attachment from email.This function is invoked when user wants to delete a attachment from existing mailbased on mail Id and attachment Id
510 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
511 * @param[in] mail_id Specifies the mail ID.
512 * @param[in] attachment_id Specifies the attachment id.
514 * @see email_mailbox_t
516 * #include "email-api-account.h"
518 * _api_sample_mail_delete_attachment()
521 * if(EMAIL_ERROR_NONE != email_delete_attachment(1))
529 EXPORT_API int email_delete_attachment(int attachment_id);
533 * @fn email_get_attachment_data(int mail_id, const char* attachment_id, email_attachment_data_t** attachment)
534 * @brief Get a mail attachment.This function is invoked when user wants to get the attachment information based on attachment id for the specified mail Id.
536 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
537 * @param[in] mail_id Specifies the mail ID.
538 * @param[in] attachment_id Specifies the buffer that a attachment ID been saved.
539 * @param[out] attachment The returned attachment is save here.
541 * @see email_mailbox_t and email_mail_attachment_info_t
544 * #include "email-api-account.h"
546 * _api_sample_mail_get_attachment_info()
548 * email_mail_attachment_info_t *mail_attach_info = NULL;
551 * int err = EMAIL_ERROR_NONE;
554 * printf("\n > Enter Mail Id: ");
555 * scanf("%d", &mail_id);
556 * printf("> attachment Id\n");
558 * if (EMAIL_ERROR_NONE != email_get_attachment_data(mail_id, &mail_attach_info))
559 * printf("email_get_attachment_data failed\n");
562 * printf("email_get_attachment_data SUCCESS\n");
564 * email_free_attachment_data(&mail_attach_info,1);
570 EXPORT_API int email_get_attachment_data(int attachment_id, email_attachment_data_t** attachment);
572 EXPORT_API int email_get_attachment_data_list(int input_mail_id, email_attachment_data_t **output_attachment_data, int *output_attachment_count);
576 * @fn email_free_attachment_data(email_attachment_data_t **attachment_data_list, int attachment_data_count)
577 * @brief Free allocated memroy for email attachment.
579 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
580 * @param[in] atch_info Specifies the pointer of mail attachment structure pointer.
582 * @see email_mail_attachment_info_t
585 * #include "email-api-account.h"
587 * _api_sample_mail_free_attachment_info()
589 * email_mailbox_t mailbox;
590 * email_mail_attachment_info_t *mail_attach_info = NULL;
591 * int mail_id = 0,account_id = 0;
593 * int err = EMAIL_ERROR_NONE;
595 * memset(&mailbox, 0x00, sizeof(email_mailbox_t));
597 * printf("\n > Enter Mail Id: ");
598 * scanf("%d", &mail_id);
599 * printf("\n > Enter account Id: ");
600 * scanf("%d", &account_id);
601 * printf("> attachment Id\n");
603 * mailbox.account_id = account_id;
604 * if (EMAIL_ERROR_NONE != email_get_attachment_data(&mailbox, mail_id, &mail_attach_info))
605 * printf("email_get_attachment_data failed\n");
608 * printf("email_get_attachment_data SUCCESS\n");
610 * email_free_attachment_info(&mail_attach_info,1);
616 EXPORT_API int email_free_attachment_data(email_attachment_data_t **attachment_data_list, int attachment_data_count);
618 /* -----------------------------------------------------------
620 -----------------------------------------------------------*/
625 * @fn email_query_mails(char *conditional_clause_string, email_mail_data_t** mail_list, int *result_count)
626 * @brief Query the mail list information from DB based on the mailbox name.
628 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
629 * @param[in] conditional_clause_string Specifies the where clause string.
630 * @param[in/out] mail_list Specifies the pointer to the structure email_mail_data_t.
631 * @param[in/out] result_count Specifies the number of mails returned.
633 * @see email_mail_list_item_t
636 * #include "email-api-account.h"
638 * _api_sample_query_mail()
640 * email_mail_data_t *mail_list = NULL;
641 * char conditional_clause_string[500];
642 * int result_count = 0;
644 * memset(conditional_clause_string, 0x00, 10);
645 * printf("\n > Enter where clause: ");
646 * scanf("%s", conditional_clause_string);
649 * if (EMAIL_ERROR_NONE != email_query_mails(conditional_clause_string, &mail_list, &result_count))
650 * printf("email_query_mails failed \n");
652 * printf("Success\n");
661 EXPORT_API int email_query_mails(char *conditional_clause_string, email_mail_data_t** mail_list, int *result_count);
665 * @fn email_query_mail_list(char *input_conditional_clause_string, email_mail_list_item_t** output_mail_list, int *output_result_count)
666 * @brief Query the mail list information from DB.
668 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
669 * @param[in] input_conditional_clause_string Specifies the where clause string.
670 * @param[in/out] output_mail_list Specifies the pointer to the structure email_mail_list_item_t.
671 * @param[in/out] output_result_count Specifies the number of mails returned.
673 * @see email_mail_list_item_t
676 * #include "email-api-account.h"
678 * _api_sample_query_mail_list()
680 * email_mail_list_item_t *mail_list = NULL;
681 * char conditional_clause_string[500];
682 * int result_count = 0;
684 * memset(conditional_clause_string, 0x00, 10);
685 * printf("\n > Enter where clause: ");
686 * scanf("%s", conditional_clause_string);
689 * if (EMAIL_ERROR_NONE != email_query_mail_list(conditional_clause_string, &mail_list, &result_count))
690 * printf("email_query_mail_list failed \n");
692 * printf("Success\n");
701 EXPORT_API int email_query_mail_list(char *input_conditional_clause_string, email_mail_list_item_t** output_mail_list, int *output_result_count);
705 * @fn email_get_mail_data(int input_mail_id, email_mail_data_t **output_mail_data)
706 * @brief Get a mail by its mail id. This function is invoked when user wants to get a mail based on mail id existing in DB.
708 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
709 * @param[in] input_mail_id specifies the mail id.
710 * @param[out] output_mail_data The returned mail is save here.
712 * @see email_mail_data_t
715 * #include "email-api-account.h"
717 * _api_sample_get_mail_data()
719 * email_mail_data_t *mail = NULL;
721 * int err = EMAIL_ERROR_NONE;
723 * printf("\n > Enter mail id: ");
724 * scanf("%d", &mail_id);
726 * if (EMAIL_ERROR_NONE != email_get_mail_data(mail_id, &mail))
727 * printf("email_get_mail_data failed\n");
730 * printf("email_get_mail_data SUCCESS\n");
732 * email_free_mail_data(&mail,1);
739 EXPORT_API int email_get_mail_data(int input_mail_id, email_mail_data_t **output_mail_data);
744 * @fn email_free_mail_data(email_mail_data_t** mail_list, int count)
745 * @brief Free allocated memroy for emails.
747 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
748 * @param[in] mail_list Specifies the pointer of mail structure pointer.
749 * @param[in] count Specifies the count of mails.
751 * @see email_mail_data_t
754 * #include "email-api-account.h"
756 * _api_sample_free_mail()
758 * email_mail_data_t *mail;
760 * //fill the mail structure
761 * //count - number of mail structure user want to free
762 * if(EMAIL_ERROR_NONE == email_free_mail_data(&mail,count))
771 EXPORT_API int email_free_mail_data(email_mail_data_t** mail_list, int count);
773 /* -----------------------------------------------------------
775 -----------------------------------------------------------*/
779 * @fn email_set_flags_field(int *mail_ids, int num, email_flags_field_type field_type, int value, int onserver)
780 * @brief Change email flags field.
781 * If the incoming_server_type is EMAIL_SERVER_TYPE_POP3 then from_server value will be 0
782 * If the incoming_server_type is EMAIL_SERVER_TYPE_IMAP4 then from_server value will be 1/0
784 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
785 * @param[in] account_id Specifies account ID.
786 * @param[in] mail_ids Specifies the array of mail ID.
787 * @param[in] num Specifies the number of mail ID.
788 * @param[in] field_type Specifies the field type what you want to set. Refer email_flags_field_type.
789 * @param[in] value Specifies the value what you want to set.
790 * @param[in] onserver Specifies whether mail Flag updation in server
794 * #include "email-api-account.h"
796 * _api_sample_set_flags_field()
798 * int account_id = 0;
800 * int err = EMAIL_ERROR_NONE;
802 * printf("\n > Enter account id: ");
803 * scanf("%d", &account_id);
805 * printf("\n > Enter mail id: ");
806 * scanf("%d", &mail_id);
807 * if (EMAIL_ERROR_NONE != email_set_flags_field(&account_id, &mail_id, EMAIL_FLAGS_SEEN_FIELD, 1, 0))
808 * printf("email_set_flags_field failed\n");
811 * printf("email_set_flags_field succeed\n");
819 EXPORT_API int email_set_flags_field(int account_id, int *mail_ids, int num, email_flags_field_type field_type, int value, int onserver);
821 /* -----------------------------------------------------------
823 -----------------------------------------------------------*/
827 * @fn email_move_mail_to_mailbox(int *mail_ids, int num, int input_target_mailbox_id)
828 * @brief Move a email to another mailbox.
830 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
831 * @param[in] mail_id Specifies the array of mail ID.
832 * @param[in] num Specifies the count of mail IDs.
833 * @param[in] input_target_mailbox_id Specifies the mailbox ID for moving email.
835 * @see email_mailbox_t
838 * #include "email-api-account.h"
840 * _api_sample_move_mail_to_mailbox()
843 * int mailbox_id = 0;
844 * int err = EMAIL_ERROR_NONE;
846 * printf("\n > Enter mail_id: ");
847 * scanf("%d",&mail_id);
849 * printf("\n > Enter target mailbox_id: ");
850 * scanf("%d",&mailbox_id);
852 * if(EMAIL_ERROR_NONE == email_move_mail_to_mailbox(&mail_id, 1, mailbox_id))
853 * printf("Success\n");
859 EXPORT_API int email_move_mail_to_mailbox(int *mail_ids, int num, int input_target_mailbox_id);
864 * @fn email_move_all_mails_to_mailbox(int input_source_mailbox_id, int input_target_mailbox_id)
865 * @brief Move all email to another mailbox.
867 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
868 * @param[in] input_source_mailbox_id Specifies the source mailbox ID for moving email.
869 * @param[in] input_target_mailbox_id Specifies the destination mailbox ID for moving email.
871 * @see email_mailbox_t
874 * #include "email-api-account.h"
876 * _api_sample_move_all_mails_to_mailbox()
878 * int src_mailbox_id;
879 * int dst_mailbox_id;
881 * int err = EMAIL_ERROR_NONE;
885 * // input mailbox information : need account_id and name (src & dest)
886 * printf("src mail maibox id> ");
887 * scanf("%d", &src_mailbox_id);
889 * // Destination mailbox
890 * printf("dest mailbox id> ");
891 * scanf("%d", &dst_mailbox_id);
893 * if( EMAIL_ERROR_NONE == email_move_all_mails_to_mailbox(src_mailbox_id, dst_mailbox_id))
895 * printf(" fail email_move_all_mails_to_mailbox: \n");
903 EXPORT_API int email_move_all_mails_to_mailbox(int input_source_mailbox_id, int input_target_mailbox_id);
908 * @fn email_get_mail_list_ex(email_list_filter_t *input_filter_list, int input_filter_count, email_list_sorting_rule_t *input_sorting_rule_list, int input_sorting_rule_count, int input_start_index, int input_limit_count, email_mail_list_item_t** output_mail_list, int *output_result_count)
909 * @brief Get the Mail List information from DB.
911 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
912 * @param[in] input_filter_list Specifies the filter list
913 * @param[in] input_filter_count Specifies the number of filter
914 * @param[in] input_sorting_rule_list Specifies the sorting rule list.
915 * @param[in] input_sorting_rule_count Specifies the number of sorting rule
916 * @param[in] input_start_index Specifies start index for LIMIT clause of SQL query.
917 * @param[in] input_limit_count Specifies limit count for LIMIT clause of SQL query.
918 * @param[in/out] output_mail_list Specifies the pointer to the structure email_mail_list_item_t.
919 * @param[in/out] output_result_count Specifies the number of mails returned.
921 * @see email_mail_list_item_t
923 * email_list_filter_t *filter_list = NULL;
924 * email_list_sorting_rule_t *sorting_rule_list = NULL;
925 * email_mail_list_item_t *result_mail_list = NULL;
926 * int result_mail_count = 0;
927 * int err = EMAIL_ERROR_NONE;
929 * filter_list = malloc(sizeof(email_list_filter_t) * 9);
930 * memset(filter_list, 0 , sizeof(email_list_filter_t) * 9);
932 * filter_list[0].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
933 * filter_list[0].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_SUBJECT;
934 * filter_list[0].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
935 * filter_list[0].list_filter_item.rule.key_value.string_type_value = strdup("RE");
936 * filter_list[0].list_filter_item.rule.case_sensitivity = false;
938 * filter_list[1].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
939 * filter_list[1].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
941 * filter_list[2].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
942 * filter_list[2].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_TO;
943 * filter_list[2].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
944 * filter_list[2].list_filter_item.rule.key_value.string_type_value = strdup("RE");
945 * filter_list[2].list_filter_item.rule.case_sensitivity = false;
947 * filter_list[3].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
948 * filter_list[3].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
950 * filter_list[4].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
951 * filter_list[4].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_CC;
952 * filter_list[4].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
953 * filter_list[4].list_filter_item.rule.key_value.string_type_value = strdup("RE");
954 * filter_list[4].list_filter_item.rule.case_sensitivity = false;
956 * filter_list[5].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
957 * filter_list[5].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
959 * filter_list[6].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
960 * filter_list[6].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_BCC;
961 * filter_list[6].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
962 * filter_list[6].list_filter_item.rule.key_value.string_type_value = strdup("RE");
963 * filter_list[6].list_filter_item.rule.case_sensitivity = false;
965 * filter_list[7].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_OPERATOR;
966 * filter_list[7].list_filter_item.operator_type = EMAIL_LIST_FILTER_OPERATOR_OR;
968 * filter_list[8].list_filter_item_type = EMAIL_LIST_FILTER_ITEM_RULE;
969 * filter_list[8].list_filter_item.rule.target_attribute = EMAIL_MAIL_ATTRIBUTE_FROM;
970 * filter_list[8].list_filter_item.rule.rule_type = EMAIL_LIST_FILTER_RULE_INCLUDE;
971 * filter_list[8].list_filter_item.rule.key_value.string_type_value = strdup("RE");
972 * filter_list[8].list_filter_item.rule.case_sensitivity = false;
974 * sorting_rule_list = malloc(sizeof(email_list_sorting_rule_t) * 2);
975 * memset(sorting_rule_list, 0 , sizeof(email_list_sorting_rule_t) * 2);
977 * sorting_rule_list[0].target_attribute = EMAIL_MAIL_ATTRIBUTE_FLAGS_SEEN_FIELD;
978 * sorting_rule_list[0].sort_order = EMAIL_SORT_ORDER_ASCEND;
980 * sorting_rule_list[1].target_attribute = EMAIL_MAIL_ATTRIBUTE_DATE_TIME;
981 * sorting_rule_list[1].sort_order = EMAIL_SORT_ORDER_ASCEND;
983 * err = email_get_mail_list_ex(filter_list, 9, sorting_rule_list, 2, -1, -1, &result_mail_list, &result_mail_count);
985 * if(err == EMAIL_ERROR_NONE) {
986 * printf("email_get_mail_list_ex succeed.\n");
988 * for(i = 0; i < result_mail_count; i++) {
989 * printf("mail_id [%d], subject [%s], from [%s]\n", result_mail_list[i].mail_id, result_mail_list[i].subject, result_mail_list[i].from);
993 * printf("email_get_mail_list_ex failed.\n");
996 * email_free_list_filter(&filter_list, 9);
1002 EXPORT_API int email_get_mail_list_ex(email_list_filter_t *input_filter_list, int input_filter_count, email_list_sorting_rule_t *input_sorting_rule_list, int input_sorting_rule_count, int input_start_index, int input_limit_count, email_mail_list_item_t** output_mail_list, int *output_result_count);
1004 EXPORT_API int email_free_list_filter(email_list_filter_t **input_filter_list, int input_filter_count);
1008 * @fn email_get_mails(int account_id , int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_data_t** mail_list, int* result_count)
1009 * @brief Get the Mail List information from DB based on the mailbox name.
1011 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1012 * @param[in] account_id Specifies the account ID
1013 * @param[in] mailbox_id Specifies the mailbox id
1014 * @param[in] thread_id Specifies the thread id. It can be EMAIL_LIST_TYPE_THREAD, EMAIL_LIST_TYPE_NORMAL or thread id.
1015 * @param[in] start_index Specifies start index for LIMIT clause of SQL query.
1016 * @param[in] limit_count Specifies limit count for LIMIT clause of SQL query.
1017 * @param[in] sorting Specifies the sorting type.
1018 * @param[in/out] mail_list Specifies the pointer to the structure email_mail_data_t.
1019 * @param[in/out] result_count Specifies the number of mails returned.
1021 * @see email_mail_data_t
1024 * #include "email-api-account.h"
1026 * _api_sample_get_mail()
1028 * email_mail_data_t *mail_list = NULL;
1030 * int result_count = 0;
1031 * int account_id = 0;
1032 * int err_code = EMAIL_ERROR_NONE;
1034 * printf("\n > Enter Mailbox id: ");
1035 * scanf("%d", mailbox_id);
1037 * printf("\n > Enter Account_id: ");
1038 * scanf("%d",&account_id);
1040 * if (EMAIL_ERROR_NONE != email_get_mails(account_id, mailbox_id, EMAIL_LIST_TYPE_NORMAL, 0, 100, EMAIL_SORT_DATETIME_HIGH, &mail_list, &result_count)) {
1041 * printf("email_get_mails failed \n");
1044 * printf("Success\n");
1054 EXPORT_API int email_get_mails(int account_id , int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_data_t** mail_list, int* result_count);
1058 * @fn email_get_mail_list(int account_id, int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count)
1059 * @brief Get the Mail List information from DB based on the mailbox name.
1061 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1062 * @param[in] account_id Specifies the account id
1063 * @param[in] mailbox_id Specifies the mailbox id
1064 * @param[in] thread_id Specifies the thread id. It can be EMAIL_LIST_TYPE_THREAD, EMAIL_LIST_TYPE_NORMAL or thread id.
1065 * @param[in] start_index Specifies start index for LIMIT clause of SQL query.
1066 * @param[in] limit_count Specifies limit count for LIMIT clause of SQL query.
1067 * @param[in] sorting Specifies the sorting type.
1068 * @param[in/out] mail_list Specifies the pointer to the structure email_mail_list_item_t.
1069 * @param[in/out] result_count Specifies the number of mails returned.
1071 * @see email_mail_list_item_t
1074 * #include "email-api-account.h"
1076 * _api_sample_get_mail()
1078 * email_mail_list_item_t *mail_list = NULL;
1080 * int result_count = 0;
1081 * int account_id = 0;
1082 * int err_code = EMAIL_ERROR_NONE;
1084 * printf("\n > Enter Mailbox id: ");
1085 * scanf("%d", mailbox_id);
1087 * printf("\n > Enter Account_id: ");
1088 * scanf("%d",&account_id);
1090 * if (EMAIL_ERROR_NONE != email_get_mail_list(account_id, mailbox_id, EMAIL_LIST_TYPE_NORMAL, 0, 100, EMAIL_SORT_DATETIME_HIGH, &mail_list, &result_count))
1092 * printf("email_get_mail_list_ex failed \n");
1096 * printf("Success\n");
1105 EXPORT_API int email_get_mail_list(int account_id, int mailbox_id, int thread_id, int start_index, int limit_count, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count);
1109 * @fn email_get_mail_by_address(int account_id, int mailbox_id, email_email_address_list_t* addr_list,
1110 int start_index, int limit_count, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count)
1111 * @brief Get the Mail List information from the DB based on the mailbox name account_id and sender address.
1113 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1114 * @param[in] account_id Specifies the Account ID
1115 * @param[in] mailbox_id Specifies the Mailbox ID
1116 * @param[in] addr_list Specifies the addresses of senders. see email_email_address_list_t
1117 * @param[in] start_index Specifies the first mail index of searched mail. This function will return mails whose index in the result list are from start_index to start_index + limit_count
1118 * @param[in] limit_count Specifies the max number of returned mails.
1119 * @param[in] search_type Specifies the search type.
1120 * @param[in] search_value Specifies the search value.
1121 * @param[in] sorting Specifies the sorting order. see email_sort_type_t
1122 * @param[in/out] mail_list Specifies the Pointer to the structure email_mail_list_item_t.
1123 * @param[in/out] result_count Specifies the Number of searched Mails
1125 * @see email_email_address_list_t, email_sort_type_t, email_mail_list_item_t
1130 EXPORT_API int email_get_mail_by_address(int account_id , int mailbox_id, email_email_address_list_t* addr_list,
1131 int start_index, int limit_count, int search_type, const char *search_value, email_sort_type_t sorting, email_mail_list_item_t** mail_list, int* result_count);
1135 * @fn email_get_thread_information_by_thread_id(int thread_id, email_mail_data_t** thread_info)
1136 * @brief Get the thread information for specific thread from DB based on the mailbox name.
1138 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1139 * @param[in] thread_id Specifies the thread_id
1140 * @param[in/out] thread_info Specifies the Pointer to the structure email_mail_data_t.
1142 * @see email_mail_data_t
1144 * #include "email-api-account.h"
1146 * _api_sample_get_thread_information()
1148 * email_mail_data_t *thread_info = NULL;
1149 * int thread_id = 0;
1150 * int err_code = EMAIL_ERROR_NONE;
1152 * printf("\n > Enter thread_id: ");
1153 * scanf("%d",&thread_id);
1155 * if ( EMAIL_ERROR_NONE != email_get_thread_information_by_thread_id(thread_id, &thread_info))
1157 * printf("email_get_thread_information_by_thread_id failed :\n"); *
1161 * printf("Success\n");
1171 EXPORT_API int email_get_thread_information_by_thread_id(int thread_id, email_mail_data_t** thread_info);
1175 * @fn email_get_thread_information_ex(int thread_id, email_mail_list_item_t** thread_info)
1176 * @brief Get the Mail List information for specific thread from DB based on the mailbox name.
1178 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1179 * @param[in] thread_id Specifies the thread_id
1180 * @param[in/out] thread_info Specifies the Pointer to the structure email_mail_list_item_t.
1182 * @see email_mail_list_item_t
1184 * #include "email-api-account.h"
1186 * _api_sample_get_thread_information_ex()
1188 * email_mail_list_item_t *thread_info = NULL;
1189 * int thread_id = 0;
1190 * int err_code = EMAIL_ERROR_NONE;
1192 * printf("\n > Enter thread_id: ");
1193 * scanf("%d",&thread_id);
1195 * if ( EMAIL_ERROR_NONE != email_get_thread_information_ex(thread_id, &thread_info))
1197 * printf("email_get_mail_list_of_thread failed :\n"); *
1201 * printf("Success\n");
1209 EXPORT_API int email_get_thread_information_ex(int thread_id, email_mail_list_item_t** thread_info);
1215 * @fn email_retry_sending_mail( int mail_id, int timeout_in_sec)
1216 * @brief Retry mail send
1218 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1219 * @param[in] mail_id Specifies the mail id for the mail to resend
1220 * @param[in] timeout_in_sec Specifies the timeout value in seconds
1225 * #include "email-api-account.h"
1227 * _api_sample_retry_send_mail()
1230 * int timeout_in_sec = 2;
1232 * if(EMAIL_ERROR_NONE == email_retry_sending_mail(mail_id,timeout_in_sec))
1241 EXPORT_API int email_retry_sending_mail(int mail_id, int timeout_in_sec);
1243 EXPORT_API int email_create_db_full();
1247 * @fn email_cancel_sending_mail( int mail_id)
1248 * @brief Callback function for cm popup. We set the status as EMAIL_MAIL_STATUS_SEND_CANCELED
1250 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1251 * @param[in] mail_id Specifies the mailID
1255 * #include "email-api-account.h"
1257 * _api_sample_cancel_send_mail()
1262 * if(EMAIL_ERROR_NONE == email_cancel_sending_mail(mail_id,))
1271 EXPORT_API int email_cancel_sending_mail(int mail_id) ;
1275 * @fn email_get_disk_space_usage(unsigned long *total_size)
1276 * @brief Gets the total disk usage of emails in KB.
1278 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1279 * @param[out] total_size total disk usage of emails
1282 * #include "email-api-account.h"
1284 * _api_sample_get_disk_space_usage()
1286 * unsigned long total_size = 0;
1288 * if ( EMAIL_ERROR_NONE != email_get_disk_space_usage(&total_size))
1289 * printf("email_get_disk_space_usage failed err : %d\n",err_code);
1291 * printf("email_get_disk_space_usage SUCCESS, total disk usage in KB : %ld \n", total_size);
1296 EXPORT_API int email_get_disk_space_usage(unsigned long *total_size);
1300 * @fn email_get_address_info_list(int mail_id, email_address_info_list_t** address_info_list)
1301 * @brief Get the address info list. The address info list contains from, to, cc, bcc addresses and their display name, contact id and etc. (see email_address_info_list_t)
1302 * Each GList (from, to, cc, bcc) is the list of email_address_info_t data.
1303 * "data" variable of GList structure contains email_address_info_t data. <br>
1304 * To get email_address_info_t data from GList, Use type casting from GList node.
1306 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1307 * @param[in] mail_id Specifies the mail id to get the list.
1308 * @param[out] address_info_list Specifies the Pointer to the structure email_address_info_list_t. Memory for a new address info list will be allocated to this. Call email_free_address_info_list() to free the memory allocated to this.
1310 * @see email_address_info_list_t, email_address_info_t, email_free_address_info_list()
1312 * #include "email-api-account.h"
1314 * _api_sample_get_address_info_list()
1316 * email_address_info_list_t *p_address_info_list= NULL;
1317 * email_address_info_t *p_address_info = NULL;
1319 * int err_code = EMAIL_ERROR_NONE;
1323 * if ( EMAIL_ERROR_NONE != (err_code = email_get_address_info_list(mail_id, &p_address_info_list)) )
1325 * printf("email_get_address_info_list failed :\n"); *
1330 * printf("Success\n");
1331 * //do something with p_address_info_list
1332 * GList *list = p_address_info_list->from;
1333 * GList *node = g_list_first(list);
1334 * while ( node != NULL )
1336 * p_address_info = (email_address_info_t*)node->data;
1337 * printf("%d, %s, %s, %d\n", p_address_info->address_type, p_address_info->address, p_address_info->display_name, p_address_info->contact_id);
1339 * node = g_list_next(node);
1343 * // Free sender list
1344 * if ( p_address_info_list )
1346 * email_free_address_info_list(&p_address_info_list);
1352 EXPORT_API int email_get_address_info_list(int mail_id, email_address_info_list_t** address_info_list);
1356 * @fn email_free_address_info_list(email_address_info_list_t **address_info_list)
1357 * @brief Free the address info list allocated by email_get_address_info_list(). This function will free the memory which is allocated to address_info_list itself.
1359 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1360 * @param[in] address_info_list Specifies the Pointer to the structure email_address_info_list_t to be freed.
1362 * @see email_address_info_list_t, email_get_address_info_list()
1364 EXPORT_API int email_free_address_info_list(email_address_info_list_t **address_info_list);
1368 * @fn email_get_structure(const char*encoded_string, void **struct_var, email_convert_struct_type_e type)
1369 * @brief This function returns the structure of the type which is indicated by 'type' variable. This function will allocate new memory to 'struct_var' for structure.<br>
1370 * Some notifications such as NOTI_DOWNLOAD_NEW_MAIL are published with string parameter. The string contains various values that might be divided by delimiter.<br>
1372 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1373 * @param[in] encoded_string Specifies the Pointer to the string from notification.
1374 * @param[out] struct_var Specifies the Pointer to the structure to be returned. If success, new memory for structure will be allocated.
1375 * @param[in] type Specifies the converting type. see email_convert_struct_type_e
1377 * @see email_convert_struct_type_e
1379 EXPORT_API int email_get_structure(const char*encoded_string, void **struct_var, email_convert_struct_type_e type);
1383 * @fn email_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req)
1384 * @brief Get the information of meeting request. The information of meeting request is based on Mail Id. <br>
1385 * The information of meeting request is corresponding to only one mail.
1386 * For this reason, the information of meeting request can be added by using email_add_message_with_meeting_request() with a matched mail information.
1388 * @return This function returns EMAIL_ERROR_NONE on success. This function returns EMAIL_ERROR_DATA_NOT_FOUND if there isn't a matched mail. Otherwise it returns error code (refer to EMAIL_ERROR_XXX) on failure.
1389 * @param[in] mail_id Specifies the Mail id for which meeting request details need to be fetched
1390 * @param[in/out] meeting_req Specifies the Pointer to the structure email_meeting_request_t.
1392 * @see email_meeting_request_t
1394 EXPORT_API int email_get_meeting_request(int mail_id, email_meeting_request_t **meeting_req);
1399 * @fn email_free_meeting_request(email_meeting_request_t** meeting_req, int count)
1400 * @brief Free the meeting request allocated by email_get_meeting_request() or alloacted to add. This function will free the memory which is allocated to meeting_req (= *meeting_req) itself.
1402 * @return This function returns EMAIL_ERROR_NONE on success or error code (refer to EMAIL_ERROR_XXX) on failure.
1403 * @param[in] email_meeting_request_t Specifies the Pointer to the structure email_meeting_request_t to be freed.
1404 * @param[in] count Specifies the number of elements in meeting_req array. this is usually 1.
1406 * @see email_meeting_request_t, email_get_meeting_request()
1408 EXPORT_API int email_free_meeting_request(email_meeting_request_t** meeting_req, int count);
1410 EXPORT_API int email_move_thread_to_mailbox(int thread_id, int target_mailbox_id, int move_always_flag);
1412 EXPORT_API int email_delete_thread(int thread_id, int delete_always_flag);
1414 EXPORT_API int email_modify_seen_flag_of_thread(int thread_id, int seen_flag, int on_server);
1416 EXPORT_API int email_expunge_mails_deleted_flagged(int input_mailbox_id, int input_on_server, unsigned *output_handle);
1420 #endif /* __cplusplus */
1427 #endif /* __EMAIL_API_MAIL_H__ */