]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/net/email.cpp
Added Net library to contrib
[wxWidgets.git] / contrib / src / net / email.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: email.h
3 // Purpose: wxEmail: portable email client class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 2001-08-21
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "email.h"
14 #endif
15
16 // For compilers that support precompilation, includes "wx/wx.h".
17 #include "wx/wxprec.h"
18
19 #ifdef __BORLANDC__
20 #pragma hdrstop
21 #endif
22
23 #ifndef WX_PRECOMP
24 #include "wx/wx.h"
25 #endif
26
27 #include "wx/string.h"
28 #include "wx/net/email.h"
29
30 #ifdef __WXMSW__
31 #include "wx/net/smapi.h"
32 #endif
33
34 // Send a message.
35 // Specify profile, or leave it to wxWindows to find the current user name
36
37 #ifdef __WXMSW__
38 bool wxEmail::Send(wxMailMessage& message, const wxString& profileName)
39 {
40 wxASSERT (message.m_to.GetCount() > 0) ;
41
42 wxString profile(profileName);
43 if (profile.IsEmpty())
44 profile = wxGetUserName();
45
46 wxMapiSession session;
47
48 if (!session.MapiInstalled())
49 return FALSE;
50 if (!session.Logon(profile))
51 return FALSE;
52
53 return session.Send(message);
54 }
55 #else
56 #error Send not yet implemented for this platform.
57 #endif
58