1 /////////////////////////////////////////////////////////////////////////////
2 // Name:        msg.h
3 // Purpose:     wxMailMessage
4 // Author:      Julian Smart
5 // Modified by:
6 // Created:     2001-08-21
7 // RCS-ID:      $Id: msg.h 28475 2004-07-25 15:44:47Z VZ $
8 // Copyright:   (c) Julian Smart
9 // Licence:     wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11 
12 #ifndef _WX_MSG_H_
13 #define _WX_MSG_H_
14 
15 #ifdef WXMAKINGDLL_NETUTILS
16     #define WXDLLIMPEXP_NETUTILS WXEXPORT
17     #define WXDLLIMPEXP_DATA_NETUTILS(type) WXEXPORT type
18 #elif defined(WXUSINGDLL)
19     #define WXDLLIMPEXP_NETUTILS WXIMPORT
20     #define WXDLLIMPEXP_DATA_NETUTILS(type) WXIMPORT type
21 #else // not making nor using DLL
22     #define WXDLLIMPEXP_NETUTILS
23     #define WXDLLIMPEXP_DATA_NETUTILS(type) type
24 #endif
25 
26 
27 /*
28  * wxMailMessage
29  * Encapsulates an email message
30  */
31 
32 class WXDLLIMPEXP_NETUTILS wxMailMessage
33 {
34 public:
35 
36     // A common usage
37     wxMailMessage(const wxString& subject, const wxString& to,
38         const wxString& body, const wxString& from = wxEmptyString,
39         const wxString& attachment = wxEmptyString,
40         const wxString& attachmentTitle = wxEmptyString)
41     {
42         m_to.Add(to);
43         m_subject = subject;
44         m_body = body;
45         m_from = from;
46         if (!attachment.IsEmpty())
47         {
48             m_attachments.Add(attachment);
49             m_attachmentTitles.Add(attachmentTitle);
50         }
51     }
52 
wxMailMessage()53     wxMailMessage() {};
54 
55 //// Accessors
56 
AddTo(const wxString & to)57     void AddTo(const wxString& to) { m_to.Add(to); }
AddCc(const wxString & cc)58     void AddCc(const wxString& cc) { m_cc.Add(cc); }
AddBcc(const wxString & bcc)59     void AddBcc(const wxString& bcc) { m_bcc.Add(bcc); }
60     void AddAttachment(const wxString& attach, const wxString& title = wxEmptyString)
61     { m_attachments.Add(attach); m_attachmentTitles.Add(title); }
62 
SetSubject(const wxString & subject)63     void SetSubject(const wxString& subject) { m_subject = subject; }
SetBody(const wxString & body)64     void SetBody(const wxString& body) { m_body = body; }
SetFrom(const wxString & from)65     void SetFrom(const wxString& from) { m_from = from; }
66 
67 public:
68     wxArrayString  m_to;               //The To: Recipients
69     wxString       m_from;             //The From: email address (optional)
70     wxArrayString  m_cc;               //The CC: Recipients
71     wxArrayString  m_bcc;              //The BCC Recipients
72     wxString       m_subject;         //The Subject of the message
73     wxString       m_body;            //The Body of the message
74     wxArrayString  m_attachments;      //Files to attach to the email
75     wxArrayString  m_attachmentTitles; //Titles to use for the email file attachments
76 };
77 
78 #endif // _WX_MSG_H_
79 
80