campo-sirio/xvaga/smapi.h
guy 941d28df75 Aggiunto supporto per mail senza outlook
git-svn-id: svn://10.65.10.50/branches/R_10_00@23147 c028cbd2-c16b-5b4b-a496-9718f37d4682
2015-11-30 16:29:32 +00:00

100 lines
3.1 KiB
C++
Executable File

/////////////////////////////////////////////////////////////////////////////
// Name: smapi.h
// Purpose: Simple MAPI classes
// Author: PJ Naughter <pjna@naughter.com>
// Modified by: Julian Smart
// Created: 2001-08-21
// RCS-ID: $Id: smapi.h,v 1.4 2010-04-22 15:26:15 guy Exp $
// Copyright: (c) PJ Naughter
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_SMAPI_H_
#define _WX_SMAPI_H_
class wxMailMessage
{
public:
// A common usage
wxMailMessage(const wxString& subject, const wxString& to,
const wxString& body, const wxString& from = wxEmptyString,
const wxString& attachment = wxEmptyString,
const wxString& attachmentTitle = wxEmptyString) : m_query_receipt(false)
{
m_to.Add(to);
m_subject = subject;
m_body = body;
m_from = from;
if (!attachment.IsEmpty())
{
m_attachments.Add(attachment);
m_attachmentTitles.Add(attachmentTitle);
}
}
wxMailMessage() : m_query_receipt(false) {}
//// Accessors
void AddTo(const wxString& to) { m_to.Add(to); }
void AddCc(const wxString& cc) { m_cc.Add(cc); }
void AddBcc(const wxString& bcc) { m_bcc.Add(bcc); }
void AddAttachment(const wxString& attach, const wxString& title = wxEmptyString)
{ m_attachments.Add(attach); m_attachmentTitles.Add(title); }
void SetSubject(const wxString& subject) { m_subject = subject; }
void SetBody(const wxString& body) { m_body = body; }
void SetFrom(const wxString& from) { m_from = from; }
bool Send(const wxString& profileName = wxEmptyString,
bool bShowUI = false, const wxString& sendMail = wxT("/usr/sbin/sendmail -t"));
public:
wxArrayString m_to; //The To: Recipients
wxString m_from; //The From: email address (optional)
wxArrayString m_cc; //The CC: Recipients
wxArrayString m_bcc; //The BCC Recipients
wxString m_subject; //The Subject of the message
wxString m_body; //The Body of the message
wxArrayString m_attachments; //Files to attach to the email
wxArrayString m_attachmentTitles; //Titles to use for the email file attachments
bool m_query_receipt; //Query receipt message
};
class wxMapiData;
//The class which encapsulates the MAPI connection
class wxMapiSession
{
public:
//Constructors / Destructors
wxMapiSession();
~wxMapiSession();
//Logon / Logoff Methods
bool Logon(const wxString& sProfileName, const wxString& sPassword = wxEmptyString, wxWindow* pParentWnd = NULL);
bool LoggedOn() const;
bool Logoff();
//Send a message
bool Send(wxMailMessage& message, bool show_ui);
//General MAPI support
bool MapiInstalled() const;
//Error Handling
long GetLastError() const;
protected:
//Methods
void Initialise();
void Deinitialise();
bool Resolve(const wxString& sName, void* lppRecip1);
wxMapiData* m_data;
};
#endif //_WX_SMAPI_H_