69 lines
5.1 KiB
C++
69 lines
5.1 KiB
C++
/*
|
|
* Purpose: private wxWindows mail transport implementation
|
|
* Author: Frank Buß
|
|
* Created: 2002
|
|
*/
|
|
|
|
#ifndef SMPT_H
|
|
#define SMPT_H
|
|
|
|
#include <wx/wx.h>
|
|
#include <wx/protocol/protocol.h>
|
|
|
|
#include "email.h"
|
|
#include "cmdprot.h"
|
|
|
|
class WXDLLIMPEXP_SMTP wxSMTPListener
|
|
{
|
|
public:
|
|
virtual void OnSocketError(int errorCode) {};
|
|
|
|
virtual void OnRecipientAdded(const wxString& address, int errorCode) {};
|
|
|
|
virtual void OnDataSent(int errorCode) {};
|
|
};
|
|
|
|
class MailState;
|
|
|
|
class WXDLLIMPEXP_SMTP wxSMTP : public wxCmdlineProtocol //, public wxEvtHandler
|
|
{
|
|
public:
|
|
wxSMTP(wxSMTPListener* pListener = NULL);
|
|
|
|
~wxSMTP();
|
|
|
|
void Send(wxEmailMessage* pMessage);
|
|
|
|
void EvaluateLine(const wxString& line);
|
|
void OnConnect(wxSocketEvent& event);
|
|
|
|
// MailStateContext interface
|
|
|
|
void ChangeState(const MailState& mailState);
|
|
|
|
void SendNextRecipient();
|
|
|
|
void OnRecipientError();
|
|
|
|
void OnRecipientSuccess();
|
|
|
|
void OnDataSuccess();
|
|
|
|
void SendFrom();
|
|
|
|
void SendData();
|
|
|
|
private:
|
|
const MailState* m_pMailState;
|
|
wxSMTPListener* m_pListener;
|
|
wxEmailMessage* m_pMessage;
|
|
|
|
// current recipient and counts
|
|
size_t m_count;
|
|
wxString m_currentRecipient;
|
|
|
|
// all recipients
|
|
wxArrayString m_recipients;
|
|
};
|
|
|
|
#endif |