2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FMsgDetailedEmailMessage.h
19 * @brief This is the header file for the %DetailedEmailMessage class.
21 * This header file contains the declarations of the %DetailedEmailMessage class.
24 #ifndef _FMSG_DETAILED_EMAIL_MESSAGE_H_
25 #define _FMSG_DETAILED_EMAIL_MESSAGE_H_
27 namespace Tizen { namespace Base
37 #include <FMsgTypes.h>
38 #include <FMsgEmailAttachment.h>
40 namespace Tizen { namespace Messaging
43 * @enum EmailMessageClass
45 * Defines the class of the email messages.
50 enum EmailMessageClass
52 EMAIL_MESSAGE_CLASS_UNSPECIFIED = 0, /**<Unspecified */
53 EMAIL_MESSAGE_CLASS_UNKNOWN, /**<Unknown */
54 EMAIL_MESSAGE_CLASS_NOTE, /**<Normal email message */
55 EMAIL_MESSAGE_CLASS_NOTE_RULES_OOF_TEMPLATE_MICROSOFT, /**<Out-of-office template */
56 EMAIL_MESSAGE_CLASS_NOTE_SMIME, /**<The message is encrypted and can also be signed */
57 EMAIL_MESSAGE_CLASS_NOTE_SMIME_MULTIPART_SIGNED, /**<The message is clear signed */
58 EMAIL_MESSAGE_CLASS_NOTIFICATION_MEETING, /**<Meeting notification */
59 EMAIL_MESSAGE_CLASS_OCTEL_VOICE, /**<Octel voice message */
60 EMAIL_MESSAGE_CLASS_SCHEDULE_MEETING_REQUEST, /**<Meeting request */
61 EMAIL_MESSAGE_CLASS_SCHEDULE_MEETING_CANCELLED, /**<Meeting cancelled */
62 EMAIL_MESSAGE_CLASS_SCHEDULE_MEETING_POSITIVE_RESPONSE, /**<Positive meeting response */
63 EMAIL_MESSAGE_CLASS_SCHEDULE_MEETING_TENTATIVE_RESPONSE, /**<Tentative meeting response */
64 EMAIL_MESSAGE_CLASS_SCHEDULE_MEETING_NEGATIVE_RESPONSE, /**<Negative meeting response */
65 EMAIL_MESSAGE_CLASS_POST, /**<Post */
66 EMAIL_MESSAGE_CLASS_INFO_PATH_FORM, /**<An InfoPath form */
67 EMAIL_MESSAGE_CLASS_VOICE_NOTES, /**<Electronic voice notes */
68 EMAIL_MESSAGE_CLASS_SHARING, /**<Shared message */
69 //EMAIL_MESSAGE_CLASS_NOTE_EXCHANGE_ACTIVE_SYNC_REMOTE_WIPE_CONFIRMATION, // should be added
70 EMAIL_MESSAGE_CLASS_VOICE_MAIL, /**<Voice mail */
71 //EMAIL_MESSAGE_CLASS_SMS,
72 //EMAIL_MESSAGE_CLASS_SMART_REPLY = 0x01000000,
73 //EMAIL_MESSAGE_CLASS_SMART_FORWARD = 0x02000000,
74 EMAIL_MESSAGE_CLASS_REPORT_NOT_READ_REPORT = 0x10000000, /**<Not read report for a standard message */
75 EMAIL_MESSAGE_CLASS_REPORT_READ_REPORT = 0x20000000, /**<Read report for a standard message */
76 EMAIL_MESSAGE_CLASS_REPORT_NON_DELIVERY_RECEIPT = 0x40000000, /**<Non-delivery report for a standard message */
77 EMAIL_MESSAGE_CLASS_REPORT_DELIVERY_RECEIPT = 0x80000000 /**<Delivery receipt for a standard message */
81 * @enum EmailDigestType
83 * Defines the digest type of the email messages.
89 EMAIL_DIGEST_TYPE_MD5 = 0, /**<The MD5 type */
90 EMAIL_DIGEST_TYPE_SHA1 /**<The SHA-1 type */
94 * @enum EmailSmimeType
96 * Defines the S/MIME type of the email messages.
102 EMAIL_SMIME_TYPE_NONE = 0, /**<The undefined type */
103 EMAIL_SMIME_TYPE_SIGNED, /**<The signed type */
104 EMAIL_SMIME_TYPE_ENCRYPTED, /**<The encrypted type */
105 EMAIL_SMIME_TYPE_SIGNED_AND_ENCRYPTED /**<Both signed and encrypted type */
109 * @enum EmailReturnReceiptType
111 * Defines the return receipt type for an email message.
115 enum EmailReturnReceiptType
117 EMAIL_RETURN_RECEIPT_TYPE_NONE = 0x00, /**<Normal Mail */
118 EMAIL_RETURN_RECEIPT_TYPE_REQUEST = 0x03, /**<MDN-requesting mail*/ // should be deprecated
119 EMAIL_RETURN_RECEIPT_TYPE_DSN = 0x04, /**<Delivery Status Notification (DSN - Delivery Status Mail)*/
120 EMAIL_RETURN_RECEIPT_TYPE_MDN = 0x08, /**<Message Disposition Notification (MDN - Read Status Mail)*/
121 //EMAIL_RETURN_RECEIPT_TYPE_REQUEST_DSN = 0x10,
122 //EMAIL_RETURN_RECEIPT_TYPE_REQUEST_MDN = 0x20,
126 * @enum EmailMessageBodyType
128 * Defines the type of an email message body.
132 enum EmailMessageBodyType
134 EMAIL_MESSAGE_BODY_TYPE_PLAIN_TEXT = 0, /**<The plain text type */
135 EMAIL_MESSAGE_BODY_TYPE_HTML, /**<The HTML type */
136 EMAIL_MESSAGE_BODY_TYPE_MIME /**<The MIME type */
140 // forward declaration
141 class _DetailedEmailMessageImpl;
144 * @class DetailedEmailMessage
145 * @brief This class provides methods for handling detailed email messages.
149 * The %DetailedEmailMessage class provides methods for handling detailed email messages.
151 class _OSP_EXPORT_ DetailedEmailMessage
152 : public Tizen::Base::Object
157 * This is the default constructor for this class.
161 DetailedEmailMessage(void);
164 * This is the destructor for this class.
168 virtual ~DetailedEmailMessage(void);
171 * This is the copy constructor for the %DetailedEmailMessage class. @n
172 * Copying of objects using this copy constructor is allowed.
176 * @param[in] rhs An instance of %DetailedEmailMessage
178 DetailedEmailMessage(const DetailedEmailMessage& rhs);
183 * Assigns the value of the specified instance to the current instance of %DetailedEmailMessage. @n
184 * Copying of objects using this copy assignment operator is allowed.
188 * @return The reference of this instance
189 * @param[in] rhs An instance of %DetailedEmailMessage
191 DetailedEmailMessage& operator =(const DetailedEmailMessage& rhs);
194 * Compares the calling instance with the specified instance.
198 * @return @c true if the specified instance of Tizen::Base::Object is equal to the calling %DetailedEmailMessage instance, @n
200 * @param[in] obj An instance of Tizen::Base::Object to compare
202 virtual bool Equals(const Tizen::Base::Object& obj) const;
205 * Gets the hash value of the current instance.
209 * @return The hash value of the current instance
211 virtual int GetHashCode(void) const;
215 ///////////////////////////////////////////////////////////////
217 ///////////////////////////////////////////////////////////////
219 * Gets the message ID.
223 * @return The message ID
224 * @see SetMessageId()
226 Tizen::Base::String GetMessageId(void) const;
229 * Gets the subject of an email message.
233 * @return The subject of an email message
236 Tizen::Base::String GetSubject(void) const;
239 * Gets the time when an email message is created.
243 * @return The time when an email message is created
244 * @remarks The creation time may be updated by mail server when an email is sent.
245 * @see SetCreationTime()
247 Tizen::Base::DateTime GetCreationTime(void) const;
250 * Gets the email address of the specific recipient type.
254 * @return The email address of the specific recipient type
255 * @param[in] type The type of recipient
256 * @exception E_SUCCESS The method is successful.
257 * @exception E_INVALID_ARG The specified @c type is invalid.
258 * @remarks The values for the various recipients can be a string with multiple email addresses separated by semi-colons(;). @n
259 * The specified @c type contains RECIPIENT_TYPE_TO, RECIPIENT_TYPE_CC, RECIPIENT_TYPE_BCC. @n
260 * The specific error code can be accessed using the GetLastResult() method.
264 Tizen::Base::String GetAddress(RecipientType type) const;
267 * Gets the email address of an author.
271 * @return The email address of an author
272 * @see SetFromAddress()
274 Tizen::Base::String GetFromAddress(void) const;
277 * Gets the email address used to reply to a message.
281 * @return The email address used to reply to a message
282 * @see SetReplyToAddress()
284 Tizen::Base::String GetReplyToAddress(void) const;
287 * Gets the return path.
291 * @return The return path
292 * @see SetReturnPath()
294 Tizen::Base::String GetReturnPath(void) const;
297 * Gets the file path of the specified message body type.
301 * @return The file path of the message body
302 * @param[in] type The type of message body
303 * @exception E_SUCCESS The method is successful.
304 * @exception E_INVALID_ARG The specified @c type is invalid.
305 * @remarks The specific error code can be accessed using the GetLastResult() method.
308 Tizen::Base::String GetFilePath(EmailMessageBodyType type) const;
311 * Gets the priority of a message.
315 * @return The priority of a message
318 EmailMessagePriority GetPriority(void) const;
321 * Gets the return receipt type of a message.
325 * @return The return receipt type of a message
326 * @see SetReturnReceiptType()
328 EmailReturnReceiptType GetReturnReceiptType(void) const;
331 * Gets the inline content count of a message.
335 * @return The inline content count of a message
336 * @see SetInlineContentCount()
338 int GetInlineContentCount(void) const;
341 * Gets the class of a message.
345 * @return The class of a message
348 EmailMessageClass GetClass(void) const;
351 * Gets the digest type of a message.
355 * @return The digest type of the message
356 * @see SetDigestType()
358 EmailDigestType GetDigestType(void) const;
361 * Gets the S/MIME type of a message.
365 * @return The S/MIME type of a message
366 * @see SetSmimeType()
368 EmailSmimeType GetSmimeType(void) const;
371 * Gets the attachment list of this message.
375 * @return A pointer to the attachment list
376 * @exception E_SUCCESS The method is successful.
377 * @exception E_OUT_OF_MEMORY The memory is insufficient.
378 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
379 * After using the attachment list, you can call Tizen::Base::Collection::IList::RemoveAll(true) to clean up items in the list.
380 * @see EmailAttachment
381 * @see SetAttachmentList()
383 Tizen::Base::Collection::IList* GetAttachmentListN(void);
387 ///////////////////////////////////////////////////////////////
389 ///////////////////////////////////////////////////////////////
391 * Sets the message ID.
395 * @return An error code
396 * @param[in] messageId The message ID
397 * @exception E_SUCCESS The method is successful.
398 * @exception E_INVALID_ARG The length of the specified @c messageId is @c 0.
399 * @remarks The message ID is an automatically generated field. @n
400 * It is used to prevent multiple delivery and for reference in In-Reply-To.
401 * @see GetMessageId()
403 result SetMessageId(const Tizen::Base::String& messageId);
406 * Sets the subject of an email message.
410 * @return An error code
411 * @param[in] subject The subject of the email message
412 * @exception E_SUCCESS The method is successful.
413 * @exception E_MAX_EXCEEDED The subject length of the message exceeds the maximum limit (Maximum 256 characters).
416 result SetSubject(const Tizen::Base::String& subject);
419 * Sets the time when an email message is created.
423 * @return An error code
424 * @param[in] dateTime The time when the email message is created
425 * @exception E_SUCCESS The method is successful.
426 * @exception E_INVALID_ARG The specified @c dateTime is invalid. @n
427 * The valid range of the time can be from "January 1 1900 00:00:00" to "December 31 2100 23:59:59".
428 * @see GetCreationTime()
430 result SetCreationTime(const Tizen::Base::DateTime& dateTime);
433 * Sets the recipient list of the specific recipient type.
437 * @return An error code
438 * @param[in] type The type of recipient
439 * @param[in] recipients The recipients string
440 * @exception E_SUCCESS The method is successful.
441 * @exception E_INVALID_ARG The specified @c type is invalid, or
442 * the specified @c recipients string length is too short (< 5).
443 * @remarks The values for the various recipients can be a string with multiple email addresses separated by semi-colons(;).@n
444 * The specified @c type contains RECIPIENT_TYPE_TO, RECIPIENT_TYPE_CC, RECIPIENT_TYPE_BCC.
447 result SetAddress(RecipientType type, const Tizen::Base::String& recipients);
450 * Sets the email address of an author.
454 * @return An error code
455 * @param[in] address The email address of the author
456 * @exception E_SUCCESS The method is successful.
457 * @exception E_INVALID_ARG The specified @c address string length is too short (< 5).
458 * @see GetFromAddress()
460 result SetFromAddress(const Tizen::Base::String& address);
463 * Sets the email address used to reply to a message.
467 * @return An error code
468 * @param[in] address The email address used to reply to the message
469 * @exception E_SUCCESS The method is successful.
470 * @exception E_INVALID_ARG The specified @c address string length is too short (< 5).
471 * @see GetReplyToAddress()
473 result SetReplyToAddress(const Tizen::Base::String& address);
476 * Sets the return path.
480 * @return An error code
481 * @param[in] address The return path
482 * @exception E_SUCCESS The method is successful.
483 * @exception E_INVALID_ARG The specified @c address string length is too short (< 5).
484 * @see GetReturnPath()
487 result SetReturnPath(const Tizen::Base::String& address);
490 * Sets the file path of the specified message body type.
494 * @return An error code
495 * @param[in] type The type of message body
496 * @param[in] filePath The file path of the message body
497 * @exception E_SUCCESS The method is successful.
498 * @exception E_INVALID_ARG The specified @c type is invalid, or
499 * the length of the specified @c filePath is too long or @c 0.
500 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
504 result SetFilePath(EmailMessageBodyType type, const Tizen::Base::String& filePath);
507 * Sets the priority of a message.
511 * @return An error code
512 * @param[in] priority The priority of the message
513 * @exception E_SUCCESS The method is successful.
514 * @exception E_INVALID_ARG The specified @c priority is invalid.
517 result SetPriority(EmailMessagePriority priority);
520 * Sets the return receipt type of a message.
524 * @return An error code
525 * @param[in] type The return receipt type of the message
526 * @exception E_SUCCESS The method is successful.
527 * @exception E_INVALID_ARG The specified @c type is invalid.
528 * @see GetReturnReceiptType()
530 result SetReturnReceiptType(EmailReturnReceiptType type);
533 * Sets the inline content count of a message.
537 * @return An error code
538 * @param[in] count The inline content count of the message
539 * @exception E_SUCCESS The method is successful.
540 * @exception E_INVALID_ARG The specified @c count is less than @c 0.
541 * @see GetInlineContentCount()
543 result SetInlineContentCount(int count);
546 * Sets the class of a message.
550 * @return An error code
551 * @param[in] messageClass The class of the message
552 * @exception E_SUCCESS The method is successful.
553 * @exception E_INVALID_ARG The specified @c messageClass is invalid.
556 result SetClass(EmailMessageClass messageClass);
559 * Sets the digest type of a message.
563 * @return An error code
564 * @param[in] type The digest type of the message
565 * @exception E_SUCCESS The method is successful.
566 * @exception E_INVALID_ARG The specified @c type is invalid.
567 * @see GetDigestType()
569 result SetDigestType(EmailDigestType type);
572 * Sets the S/MIME type of a message.
576 * @return An error code
577 * @param[in] type The S/MIME type of the message
578 * @exception E_SUCCESS The method is successful.
579 * @exception E_INVALID_ARG The specified @c type is invalid.
580 * @see GetSmimeType()
582 result SetSmimeType(EmailSmimeType type);
585 * Sets the attachment list for this message.
589 * @return An error code
590 * @param[in] pList A list of EmailAttachment
591 * @exception E_SUCCESS The method is successful.
592 * @exception E_INVALID_ARG The list is not made of EmailAttachment.
593 * @see EmailAttachment
594 * @see GetAttachmentListN()
596 result SetAttachmentList(const Tizen::Base::Collection::IList* pList);
599 ///////////////////////////////////////////////////////////////
601 ///////////////////////////////////////////////////////////////
603 * Parses the MIME file to %DetailedEmailMessage format.
607 * @return An error code
608 * @param[in] filePath The MIME file path to parse
609 * @param[out] message The parsed message
610 * @exception E_SUCCESS The method is successful.
611 * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
612 * @exception E_PARSING_FAILED The method has failed to parse the MIME file.
613 * @exception E_SYSTEM A system error has occurred.
614 * @see WriteToMimeFile()
616 static result ParseMimeFile(const Tizen::Base::String& filePath, DetailedEmailMessage& message);
619 * Writes to the MIME file from %DetailedEmailMessage.
623 * @return An error code
624 * @param[in] message The message to read
625 * @param[in] filePath The file path of the MIME file to write
626 * @exception E_SUCCESS The method is successful.
627 * @exception E_INVALID_ARG The value of the specified @c message is invalid. @n
628 * (The subject, body, recipients and from address field of the message are all empty.)
629 * @exception E_ILLEGAL_ACCESS The specified @c filePath is inaccessible as per the Tizen platform policy.
630 * @exception E_FILE_ALREADY_EXIST The specified file already exists.
631 * @exception E_SYSTEM A system error has occurred.
632 * @see ParseMimeFile()
634 static result WriteToMimeFile(const DetailedEmailMessage& message, const Tizen::Base::String& filePath);
637 _DetailedEmailMessageImpl* __pImpl;
640 friend class _DetailedEmailMessageImpl;
641 }; // DetailedEmailMessage
642 } } // Tizen::Messaging
644 #endif // _FMSG_DETAILED_EMAIL_MESSAGE_H_