Patch level : 12.00

Files correlati     :

Commento:
wxSMTP
This commit is contained in:
Alessandro Bonazzi 2024-11-05 20:43:31 +01:00
parent dfc020fe21
commit 5e9513c5b2
56 changed files with 2749 additions and 0 deletions

123
libraries/wxSMTP/base64.cpp Normal file
View File

@ -0,0 +1,123 @@
//*********************************************************************
//* Base64 - a simple base64 encoder and decoder.
//*
//* Copyright (c) 1999, Bob Withers - bwit@pobox.com
//*
//* This code may be freely used for any purpose, either personal
//* or commercial, provided the authors copyright notice remains
//* intact.
//*********************************************************************
//
// converted to wxWindows by Frank Buß
//
#include "Base64.h"
const wxChar fillchar = '=';
// 00000000001111111111222222
// 01234567890123456789012345
static wxString cvt = _T("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
// 22223333333333444444444455
// 67890123456789012345678901
"abcdefghijklmnopqrstuvwxyz"
// 555555556666
// 234567890123
"0123456789+/");
wxString wxBase64::Encode(const wxUint8* pData, size_t len)
{
size_t c;
wxString ret;
ret.Alloc(len * 4 / 3 + len * 2 / 50);
size_t resultLen = 0;
wxString cr(wxT("\x00d\x00a"));
for (size_t i = 0; i < len; ++i)
{
c = (pData[i] >> 2) & 0x3f;
ret.Append(cvt[c], 1);
if (++resultLen == 72) { ret += cr; resultLen = 0; }
c = (pData[i] << 4) & 0x3f;
if (++i < len)
c |= (pData[i] >> 4) & 0x0f;
ret.Append(cvt[c], 1);
if (++resultLen == 72) { ret += cr; resultLen = 0; }
if (i < len)
{
c = (pData[i] << 2) & 0x3f;
if (++i < len)
c |= (pData[i] >> 6) & 0x03;
ret.Append(cvt[c], 1);
}
else
{
++i;
ret.Append(fillchar, 1);
}
if (++resultLen == 72) { ret += cr; resultLen = 0; }
if (i < len)
{
c = pData[i] & 0x3f;
ret.Append(cvt[c], 1);
}
else
{
ret.Append(fillchar, 1);
}
if (++resultLen == 72) { ret += cr; resultLen = 0; }
}
return ret;
}
wxString wxBase64::Decode(const wxString& data)
{
int c;
int c1;
size_t len = data.Length();
wxString ret;
ret.Alloc(data.Length() * 3 / 4);
for (size_t i = 0; i < len; ++i)
{
// TODO: check all Find results for -1 as result of wrong input data for release build
c = cvt.Find(data[i]);
wxASSERT_MSG(c >= 0, _T("invalid base64 input"));
++i;
c1 = cvt.Find(data[i]);
wxASSERT_MSG(c1 >= 0, _T("invalid base64 input"));
c = (c << 2) | ((c1 >> 4) & 0x3);
ret.Append(c, 1);
if (++i < len)
{
c = data[i];
if (fillchar == c)
break;
c = cvt.Find(c);
wxASSERT_MSG(c >= 0, _T("invalid base64 input"));
c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf);
ret.Append(c1, 1);
}
if (++i < len)
{
c1 = data[i];
if (fillchar == c1)
break;
c1 = cvt.Find(c1);
wxASSERT_MSG(c1 >= 0, _T("invalid base64 input"));
c = ((c << 6) & 0xc0) | c1;
ret.Append(c, 1);
}
}
return ret;
}

27
libraries/wxSMTP/base64.h Normal file
View File

@ -0,0 +1,27 @@
//*********************************************************************
//* C_Base64 - a simple base64 encoder and decoder.
//*
//* Copyright (c) 1999, Bob Withers - bwit@pobox.com
//*
//* This code may be freely used for any purpose, either personal
//* or commercial, provided the authors copyright notice remains
//* intact.
//*********************************************************************
//
// converted to wxWindows by Frank Buß
//
#ifndef BASE64_H
#define BASE64_H
#include <wx/wx.h>
class wxBase64
{
public:
static wxString Encode(const wxUint8* pData, size_t length);
static wxString Decode(const wxString& data);
};
#endif

View File

@ -0,0 +1,127 @@
/*
* Purpose: private wxWindows mail transport implementation
* Author: Frank Buß
* Created: 2002
*/
#include <wx/sckstrm.h>
#include "cmdprot.h"
#define SOCKET_ID 1
class wxCmdlineProtocolSocketEventHandler : public wxEvtHandler
{
public:
wxCmdlineProtocolSocketEventHandler(wxCmdlineProtocol& callback) : m_callback(callback)
{
}
void OnSocketEvent(wxSocketEvent& event)
{
m_callback.OnSocketEvent(event);
}
private:
wxCmdlineProtocol& m_callback;
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxCmdlineProtocolSocketEventHandler, wxEvtHandler)
EVT_SOCKET(SOCKET_ID, wxCmdlineProtocolSocketEventHandler::OnSocketEvent)
END_EVENT_TABLE()
wxCmdlineProtocol::wxCmdlineProtocol()
{
m_pCmdlineProtocolSocketEventHandler = new wxCmdlineProtocolSocketEventHandler(*this);
}
wxCmdlineProtocol::~wxCmdlineProtocol()
{
delete m_pCmdlineProtocolSocketEventHandler;
}
void wxCmdlineProtocol::SetHost(const wxString& host, int service, const wxString& user, const wxString& password)
{
m_host = host;
m_user = user;
m_service = service;
m_password = password;
}
void wxCmdlineProtocol::Connect()
{
if (IsConnected()) Close();
SetTimeout(60);
SetEventHandler(*m_pCmdlineProtocolSocketEventHandler, SOCKET_ID);
SetNotify(wxSOCKET_CONNECTION_FLAG | wxSOCKET_INPUT_FLAG | wxSOCKET_LOST_FLAG);
Notify(TRUE);
// connect
wxIPV4address addr;
addr.Hostname(m_host);
addr.Service(m_service); // TODO: perhaps the port should not be hardcoded?
wxSocketClient::Connect(addr, FALSE);
}
void wxCmdlineProtocol::OnInput(wxSocketEvent& event)
{
// TODO: implementing response timeout somewhere
// get data
const int bufsize = 256;
#if wxUSE_UNICODE
wchar_t buf[bufsize];
#else
char buf[bufsize];
#endif
Read(buf, bufsize);
m_inputLine += wxString(buf, LastCount());
// search for a newline
while (true) {
size_t pos = 0;
while (pos < m_inputLine.Length() - 1) {
if (m_inputLine[pos] == 13) {
if (m_inputLine[pos + 1] == 10)
{
// line found, evaluate
EvaluateLine(m_inputLine.Mid(0, pos));
// adjust buffer
m_inputLine = m_inputLine.Mid(pos + 2);
return;
}
break;
}
pos++;
}
}
}
void wxCmdlineProtocol::OnSocketEvent(wxSocketEvent& event)
{
wxString s = _("OnSocketEvent: ");
switch(event.GetSocketEvent())
{
case wxSOCKET_INPUT:
OnInput(event);
break;
case wxSOCKET_LOST:
// TODO: error handling
break;
case wxSOCKET_CONNECTION:
OnConnect(event);
break;
}
}
void wxCmdlineProtocol::Write(const wxString& msg)
{
wxSocketClient::Write(msg, msg.Length());
}

View File

@ -0,0 +1,51 @@
/*
* Purpose: base class for all command line oriented internet protocols
* Author: Frank Buß
* Created: 2002
*/
#ifndef CMDPROT_H
#define CMDPROT_H
#include <wx/wx.h>
#include "dllimpexp.h"
#include "email.h"
class WXDLLIMPEXP_SMTP wxCmdlineProtocolSocketEventHandler;
class WXDLLIMPEXP_SMTP wxCmdlineProtocol : public wxSocketClient
{
public:
wxCmdlineProtocol();
~wxCmdlineProtocol();
void SetHost(const wxString& host, int service = 25, const wxString& user = wxT(""), const wxString& password = wxT(""));
void Connect();
// handling for wxSOCKET_INPUT
virtual void EvaluateLine(const wxString& line) = 0;
virtual void OnConnect(wxSocketEvent& event) = 0;
void OnInput(wxSocketEvent& event);
void OnSocketEvent(wxSocketEvent& event);
void Write(const wxString& msg);
private:
wxCmdlineProtocolSocketEventHandler* m_pCmdlineProtocolSocketEventHandler;
bool m_bConnected;
wxString m_inputLine;
wxString m_host;
int m_service;
wxString m_user;
wxString m_password;
};
#endif

View File

@ -0,0 +1,12 @@
#ifndef DLLIMPEXP_H
#define DLLIMPEXP_H
#ifdef WXMAKINGDLL_SMTP
#define WXDLLIMPEXP_SMTP WXEXPORT
#elif defined(WXUSINGDLL)
#define WXDLLIMPEXP_SMTP WXIMPORT
#else // not making nor using DLL
#define WXDLLIMPEXP_SMTP
#endif
#endif

120
libraries/wxSMTP/email.cpp Normal file
View File

@ -0,0 +1,120 @@
/*
* Purpose: wxWindows email implementation
* Author: Frank Buß
* Created: 2002
*/
#include "email.h"
#include "Base64.h"
wxEmailMessage::wxEmailMessage(const wxString& subject, const wxString& text, const wxString& from) :
m_subject(subject),
m_text(text),
m_from(from)
{
}
const wxString& wxEmailMessage::GetFrom()
{
return m_from;
}
void wxEmailMessage::AddRecipient(const wxString& address)
{
m_rcptArray.Add(address);
}
void wxEmailMessage::AddTo(const wxString& address)
{
m_toArray.Add(address);
}
void wxEmailMessage::AddCc(const wxString& address)
{
m_ccArray.Add(address);
}
void wxEmailMessage::AddBcc(const wxString& address)
{
m_bccArray.Add(address);
}
void wxEmailMessage::AddFile(const wxFileName& fileName, const wxString mimeMainType, const wxString mimeSubType)
{
// add new entry
m_mimeParts.Add(wxMimePart(fileName));
}
wxRecipientsIterator wxEmailMessage::GetRecipientsIterator()
{
return wxRecipientsIterator(*this);
}
void wxEmailMessage::Encode(wxOutputStream& out)
{
// TODO: use only MIME if neccessary
wxString header;
wxString cr(wxT("\x00d\x00a"));
// TODO: calculate a more random boundary
wxString boundary(wxT("---_0123456789-boundary-9876543210_---"));
wxString boundarySep = wxT("--") + boundary + cr;
header << wxT("From: ") << m_from << cr;
// TODO: add to, cc and bcc in the right format with line breaking, if too long
header << wxT("Bcc:") << cr
<< wxT("Subject: ") << m_subject << cr // TODO: add Date:
<< wxT("MIME-Version: 1.0") << cr
<< wxT("Content-Type: multipart/mixed; boundary=\"") << boundary << wxT("\"") << cr
<< cr
<< cr
<< wxT("This is a multi-part message in MIME format") << cr
<< cr
<< boundarySep
<< wxT("Content-Type: text/plain; charset=iso-8859-1") << cr
<< wxT("Content-Transfer-Encoding: 8bit") << cr
<< cr
<< m_text << cr; // TODO: is it possible in MIME message to have a single '.' on a line?
out.Write((const char*) header.mb_str(), header.Length());
for (size_t i = 0; i < m_mimeParts.GetCount(); i++) {
out.Write((const char*) boundarySep.mb_str(), boundarySep.Length());
m_mimeParts[i].Encode(out);
}
wxString footer = wxT("--") + boundary + wxT("--") + cr + wxT(".") + cr; // TODO: perhaps moving the '.\r\n' sequence to another place
out.Write((const char*) footer.mb_str(), footer.Length());
}
wxRecipientsIterator::wxRecipientsIterator(const wxEmailMessage& emailMessage) :
m_emailMessage(emailMessage)
{
m_rcptCount = 0;
m_toCount = 0;
m_ccCount = 0;
m_bccCount = 0;
}
bool wxRecipientsIterator::HasNext()
{
if (m_rcptCount < m_emailMessage.m_rcptArray.GetCount() ||
m_toCount < m_emailMessage.m_toArray.GetCount() ||
m_ccCount < m_emailMessage.m_ccArray.GetCount() ||
m_bccCount < m_emailMessage.m_bccArray.GetCount())
{
return true;
}
return false;
}
wxString wxRecipientsIterator::GetNext()
{
if (m_rcptCount < m_emailMessage.m_rcptArray.GetCount()) {
return m_emailMessage.m_rcptArray[m_rcptCount++];
} else if (m_toCount < m_emailMessage.m_toArray.GetCount()) {
return m_emailMessage.m_toArray[m_toCount++];
} else if (m_ccCount < m_emailMessage.m_ccArray.GetCount()) {
return m_emailMessage.m_ccArray[m_ccCount++];
} else if (m_bccCount < m_emailMessage.m_bccArray.GetCount()) {
return m_emailMessage.m_bccArray[m_bccCount++];
}
return wxT("");
}

77
libraries/wxSMTP/email.h Normal file
View File

@ -0,0 +1,77 @@
/*
* Purpose: wxWindows email implementation
* Author: Frank Buß
* Created: 2002
*/
#ifndef EMAIL_H
#define EMAIL_H
#include <wx/wx.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include "dllimpexp.h"
#include "mime.h"
// forward declaration
class wxRecipientsIterator;
class WXDLLIMPEXP_SMTP wxEmailMessage
{
public:
wxEmailMessage(const wxString& subject, const wxString& text, const wxString& from);
const wxString& GetFrom();
void AddRecipient(const wxString& address);
void AddTo(const wxString& address);
void AddCc(const wxString& address);
void AddBcc(const wxString& address);
// loads the file in memory and adds it to the message.
void AddFile(const wxFileName& fileName, const wxString mimeMainType = wxT(""), const wxString mimeSubType = wxT(""));
wxRecipientsIterator GetRecipientsIterator();
//
void Encode(wxOutputStream& out);
private:
wxString m_subject;
wxString m_text;
wxString m_from;
wxArrayString m_rcptArray;
wxArrayString m_toArray;
wxArrayString m_ccArray;
wxArrayString m_bccArray;
wxArrayMimePart m_mimeParts;
friend class wxRecipientsIterator;
};
class wxRecipientsIterator
{
public:
wxRecipientsIterator(const wxEmailMessage& emailMessage);
bool HasNext();
wxString GetNext();
private:
const wxEmailMessage& m_emailMessage;
size_t m_rcptCount;
size_t m_toCount;
size_t m_ccCount;
size_t m_bccCount;
};
#endif

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

91
libraries/wxSMTP/mime.cpp Normal file
View File

@ -0,0 +1,91 @@
/*
* Purpose: wxWindows mime implementation
* Author: Frank Buß
* Created: 2002
*/
#include "email.h"
#include "Base64.h"
#include "wx/arrimpl.cpp"
WX_DEFINE_OBJARRAY(wxArrayMimePart);
struct wxMimeTypeMapping
{
const wxChar* extension;
const wxChar* mainType;
const wxChar* subType;
};
// extension, main type, sub type
// TODO: must be merged / integrated / substituted with wxFileType
static const wxMimeTypeMapping g_mimeTypeMappings[] =
{
{ _T("txt"), _T("text"), _T("plain") },
{ _T("htm"), _T("text"), _T("html") },
{ _T("html"), _T("text"), _T("html") },
{ _T("gif"), _T("image"), _T("gif") },
{ _T("png"), _T("image"), _T("png") },
{ _T("jpg"), _T("image"), _T("jpeg") },
{ _T("jpeg"), _T("image"), _T("jpeg") },
{ _T("pdf"), _T("application"), _T("pdf") },
{ _T("doc"), _T("application"), _T("msword") }
};
wxMimePart::wxMimePart(const wxFileName& fileName) :
m_fileName(fileName)
{
// setup default encoding
m_mainType = _T("application");
m_subType = _T("octet-stream");
// try to determine encoding by filename extension
wxString ext = fileName.GetExt().Lower();
for (int i = 0; i < sizeof(g_mimeTypeMappings) / sizeof(wxMimeTypeMapping); i++) {
if (g_mimeTypeMappings[i].extension == ext) {
m_mainType = g_mimeTypeMappings[i].mainType;
m_subType = g_mimeTypeMappings[i].subType;
break;
}
}
}
void wxMimePart::Encode(wxOutputStream& out)
{
// TODO: error handling for every return
// TODO: encoding it on-the-fly without loading it all in memory
wxFileInputStream in(m_fileName.GetFullPath());
if (!in.Ok()) return;
// determine file length
// TODO: perhaps this can be added to wxFileName for size()
in.SeekI(0, wxFromEnd);
size_t len = (size_t) in.TellI();
in.SeekI(0);
// that's possible for windows (#include <sys/types.h> and #include <sys/stat.h>):
// struct _stat lenStat;
// if (_stat(filename, &lenStat) == -1) return error;
// size_t len = (size_t) lenStat.st_size;
if (len == 0) return;
// read file
wxUint8* pData = new wxUint8[len];
if (!pData) {
wxASSERT_MSG(pData != NULL, _T("out of memory"));
return;
}
in.Read(pData, len);
// write encoded mime part to stream
wxString cr(wxT("\x00d\x00a"));
wxString result;
result << wxT("Content-Type: ") << m_mainType << wxT("/") << m_subType << wxT("; name=\"") << m_fileName.GetFullName() + wxT("\"") + cr
<< wxT("Content-Transfer-Encoding: base64") << cr
<< wxT("Content-Disposition: attachment; filename=\"") << m_fileName.GetName() << wxT("\"") << cr
<< cr
<< wxBase64::Encode(pData, len) << cr;
out.Write((const char*) result.mb_str(), result.Length());
}

29
libraries/wxSMTP/mime.h Normal file
View File

@ -0,0 +1,29 @@
/*
* Purpose: wxWindows mime implementation
* Author: Frank Buß
* Created: 2002
*/
#ifndef MIME_H
#define MIME_H
#include <wx/wx.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
class WXDLLIMPEXP_SMTP wxMimePart
{
public:
wxMimePart(const wxFileName& fileName);
void Encode(wxOutputStream& out);
private:
wxFileName m_fileName;
wxString m_mainType;
wxString m_subType;
};
WX_DECLARE_OBJARRAY(wxMimePart, wxArrayMimePart);
#endif

105
libraries/wxSMTP/smtp.cpp Normal file
View File

@ -0,0 +1,105 @@
/*
* Purpose: private wxWindows mail transport implementation
* Author: Frank Buß
* Created: 2002
*/
#include <wx/sckstrm.h>
#include "smtp.h"
#include "states.h"
#define SOCKET_ID 1
wxSMTPListener g_nullListener;
wxSMTP::wxSMTP(wxSMTPListener* pListener) :
m_pMailState(&g_initialState)
{
if (pListener) {
m_pListener = pListener;
} else {
m_pListener = &g_nullListener;
}
m_pMessage = NULL;
}
wxSMTP::~wxSMTP()
{
}
void wxSMTP::EvaluateLine(const wxString& line)
{
// TODO: implementing response timeout somewhere
// TODO: implementing multiline response
// get command
unsigned long cmd = 0;
line.ToULong(&cmd);
m_pMailState->onResponse(*this, cmd);
}
void wxSMTP::OnConnect(wxSocketEvent& event)
{
m_pMailState->onConnect(*this, event);
}
void wxSMTP::Send(wxEmailMessage* pMessage)
{
// no message means nothing to do
if (!pMessage) return;
m_pMessage = pMessage;
// add recipients from message
wxRecipientsIterator ri = m_pMessage->GetRecipientsIterator();
while (ri.HasNext()) m_recipients.Add(ri.GetNext());
m_count = 0;
// init new socket connection
m_pMailState = &g_initialState;
Connect();
}
void wxSMTP::ChangeState(const MailState& mailState)
{
m_pMailState = &mailState;
}
void wxSMTP::SendNextRecipient()
{
if (m_count < m_recipients.GetCount()) {
m_currentRecipient = m_recipients[m_count++];
Write(wxT("RCPT TO:<") + m_currentRecipient + wxT(">\x00d\x00a"));
} else {
ChangeState(g_startDataState);
Write(wxT("DATA\x00d\x00a"));
}
}
void wxSMTP::OnRecipientError()
{
m_pListener->OnRecipientAdded(m_currentRecipient, 0);
}
void wxSMTP::OnRecipientSuccess()
{
m_pListener->OnRecipientAdded(m_currentRecipient, 1);
}
void wxSMTP::OnDataSuccess()
{
m_pListener->OnDataSent(1);
}
void wxSMTP::SendFrom()
{
Write(wxT("MAIL FROM:<") + m_pMessage->GetFrom() + wxT(">\x00d\x00a"));
}
void wxSMTP::SendData()
{
wxSocketOutputStream out(*this);
// wxFileOutputStream out("mail.txt");
m_pMessage->Encode(out);
}

69
libraries/wxSMTP/smtp.h Normal file
View File

@ -0,0 +1,69 @@
/*
* 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

251
libraries/wxSMTP/snddlg.cpp Normal file
View File

@ -0,0 +1,251 @@
/*
* Purpose: Sample application for demonstrating and testing the wxWindows email support
* Author: Frank Buß
* Created: 2002
*/
#include <wx/datstrm.h>
#include "snddlg.h"
#include "wino.h"
static const wxUint32 g_admFileId = ('a' | ('d' << 8) | ('m' << 16));
static const wxUint32 g_admFileVersion = 1;
// file format tags
enum {
admTagEnd = 0,
admTagGrid = 2
};
BEGIN_EVENT_TABLE(SendDialog, wxDialog)
END_EVENT_TABLE()
size_t g_emailCount;
static bool checkEmail(wxString& email)
{
static bool validChars[256];
static bool initialized = false;
if (!initialized) {
unsigned i;
for (i = 0; i <= 255; i++) validChars[i] = false;
for (i = 'a'; i <= 'z'; i++) validChars[i] = true;
for (i = 'A'; i <= 'Z'; i++) validChars[i] = true;
for (i = '0'; i <= '9'; i++) validChars[i] = true;
validChars['@'] = true;
validChars['.'] = true;
validChars['_'] = true;
validChars['-'] = true;
validChars['~'] = true;
initialized = true;
}
// check for valid emails
unsigned atcount = 0;
unsigned atposition = 0;
if (email.Length() < 3) return false;
for (unsigned i = 0; i < email.Length(); i++) {
wxChar c = email[i];
if (!validChars[c]) return false;
if (c == '@') {
atcount++;
atposition = i;
if (atcount > 1) return false;
}
}
if (atcount != 1) return false;
if (atposition == 0 || atposition == email.Length() - 1) return false;
// valid
return true;
}
static void addEmails(wxEmailMessage* pMessage, wxFileName* pFilename)
{
// open file; TODO: file locking
wxFileInputStream fileInStream(pFilename->GetFullPath());
wxDataInputStream in(fileInStream);
// check if right file format and file is readable
wxUint32 id = in.Read32();
wxUint32 version = in.Read32();
if (!in.IsOk() || id != g_admFileId || version > g_admFileVersion) {
wxMessageDialog errorDialog(NULL, "Fehler beim Öffnen der Datei " + pFilename->GetFullPath() + ", diese Datei wird ignoriert.", "Wino", wxOK | wxICON_INFORMATION);
errorDialog.ShowModal();
return;
}
// read file
bool end = false;
while (!end) {
wxUint32 tag = in.Read32();
wxUint32 size = in.Read32();
switch (tag) {
case admTagGrid:
{
// read number of cols and rows
size_t cols = in.Read32();
size_t rows = in.Read32();
// read column labels and widths
bool found = false;
size_t emailIndex = 0;
size_t i;
for (i = 0; i < cols; i++) {
wxString colLabel = in.ReadString();
if (colLabel.CmpNoCase("email") == 0) {
found = true;
emailIndex = i;
}
in.Read32();
}
if (!found) {
wxString error;
error << "Die Datei " << pFilename->GetFullPath() << " enthält keine Tabellenspalte\n"
<< "mit dem Namen 'eMail' und wird daher ignoriert.";
wxMessageDialog errorDialog(NULL, error, "Wino", wxOK | wxICON_INFORMATION);
errorDialog.ShowModal();
return;
}
// read emails
for (i = 0; i < rows; i++) {
for (size_t j = 0; j < cols; j++) {
if (j == emailIndex) {
wxString email = in.ReadString();
if (checkEmail(email)) {
pMessage->AddRecipient(email);
g_emailCount++;
}
} else {
in.ReadString();
}
}
}
return;
}
break;
case admTagEnd:
end = true;
break;
default:
fileInStream.SeekI(size, wxFromCurrent);
}
}
}
SendDialog::SendDialog(WinoDialog& winoDialog)
: wxDialog(&winoDialog, -1,
_("Wino eMail Versand"),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
{
wxString server = winoDialog.m_pServerTextCtrl->GetValue().Trim();
wxString subject = winoDialog.m_pSubjectTextCtrl->GetValue().Trim();
wxString text = winoDialog.m_pTextTextCtrl->GetValue().Trim();
wxString from = winoDialog.m_pFromTextCtrl->GetValue().Trim();
wxString to = winoDialog.m_pToTextCtrl->GetValue().Trim();
g_emailCount = 0;
m_successCount = 0;
wxBusyCursor wait;
// create transport class
m_pSMTP = new wxSMTP(this);
m_pSMTP->SetHost(server);
// create message class
m_pMessage = new wxEmailMessage(subject, text, from);
// add 'to'-recipient to message
m_pMessage->AddTo(to);
// add files to message
int i;
for (i = 0; i < winoDialog.m_pFilelist->GetCount(); i++) {
wxFileName* pFilename = (wxFileName*) winoDialog.m_pFilelist->GetClientData(i);
m_pMessage->AddFile(*pFilename);
}
// add emails to message
for (i = 0; i < winoDialog.m_pAddresslist->GetCount(); i++) {
wxFileName* pFilename = (wxFileName*) winoDialog.m_pAddresslist->GetClientData(i);
addEmails(m_pMessage, pFilename);
}
// convert email count to string
wxString emailCount;
emailCount << g_emailCount;
// create dialog
wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* pStatusSizer = new wxBoxSizer(wxHORIZONTAL);
pStatusSizer->Add(new wxStaticText(this, -1, "Status:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pStatusText = new wxStaticText(this, -1, "eMail-Adressen werden gesendet...", wxDefaultPosition, wxSize(100, 10));
pStatusSizer->Add(m_pStatusText, 3, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pStatusSizer, 0, wxEXPAND);
wxBoxSizer* pEmailCountSizer = new wxBoxSizer(wxHORIZONTAL);
pEmailCountSizer->Add(new wxStaticText(this, -1, "Anzahl gültiger eMail Adressen:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pEmailCountText = new wxStaticText(this, -1, emailCount, wxDefaultPosition, wxSize(100, 10));
pEmailCountSizer->Add(m_pEmailCountText, 3, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pEmailCountSizer, 0, wxEXPAND);
wxBoxSizer* pEmailSuccessSizer = new wxBoxSizer(wxHORIZONTAL);
pEmailSuccessSizer->Add(new wxStaticText(this, -1, "Davon erfolgreich versendet:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pEmailSuccessText = new wxStaticText(this, -1, "0", wxDefaultPosition, wxSize(100, 10));
pEmailSuccessSizer->Add(m_pEmailSuccessText, 3, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pEmailSuccessSizer, 0, wxEXPAND);
wxStaticBoxSizer* pLogSizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, "Bericht"), wxVERTICAL);
m_pLogTextCtrl = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(500, 300), wxTE_MULTILINE | wxTE_READONLY);
pLogSizer->Add(m_pLogTextCtrl, 0, wxEXPAND | wxALL, 10);
pTopSizer->Add(pLogSizer, 0, wxEXPAND | wxALL, 10);
wxBoxSizer* pSendCloseSizer = new wxBoxSizer(wxHORIZONTAL);
wxButton* pCloseButton = new wxButton(this, wxID_CANCEL, "Beenden");
pCloseButton->SetDefault();
pSendCloseSizer->Add(pCloseButton, 0, wxALL, 10);
pTopSizer->Add(pSendCloseSizer, 0, wxALIGN_RIGHT);
SetAutoLayout(true);
SetSizer(pTopSizer);
pTopSizer->Fit(this);
pTopSizer->SetSizeHints(this);
// show dialog
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
// start email sending
m_pSMTP->Send(m_pMessage);
}
SendDialog::~SendDialog()
{
delete m_pSMTP;
delete m_pMessage;
}
void SendDialog::OnSocketError(int errorCode)
{
}
void SendDialog::OnRecipientAdded(const wxString& address, int errorCode)
{
if (errorCode) {
m_successCount++;
wxString l;
l << m_successCount;
m_pEmailSuccessText->SetLabel(l);
}
}
void SendDialog::OnDataSent(int errorCode)
{
m_pStatusText->SetLabel("eMail-Versand beendet.");
wxMessageBox(_("eMail-Versand beendet."), _("Wino"), wxOK | wxICON_INFORMATION);
}

45
libraries/wxSMTP/snddlg.h Normal file
View File

@ -0,0 +1,45 @@
/*
* Purpose: Sample application for demonstrating and testing the wxWindows email support
* Author: Frank Buß
* Created: 2002
*/
#ifndef SNDDLG_H
#define SNDDLG_H
#include <wx/wx.h>
#include <wx/listctrl.h>
#include "smtp.h"
class WinoDialog;
class SendDialog : public wxDialog, public wxSMTPListener
{
public:
SendDialog(WinoDialog& winoDialog);
virtual ~SendDialog();
void OnSocketError(int errorCode);
void OnRecipientAdded(const wxString& address, int errorCode);
void OnDataSent(int errorCode);
private:
wxSMTP* m_pSMTP;
wxEmailMessage* m_pMessage;
wxStaticText* m_pStatusText;
wxStaticText* m_pEmailCountText;
wxStaticText* m_pEmailSuccessText;
wxTextCtrl* m_pLogTextCtrl;
size_t m_successCount;
DECLARE_EVENT_TABLE()
};
#endif

View File

@ -0,0 +1,94 @@
/*
* Purpose: private wxWindows helper classes for SMTP
* Author: Frank Buß
* Created: 2002
*/
#include "states.h"
const InitialState g_initialState;
const ConnectedState g_connectedState;
const HeloState g_heloState;
const SendMailFromState g_sendMailFromState;
const RcptListState g_rcptListState;
const StartDataState g_startDataState;
const DataState g_dataState;
void InitialState::onConnect(wxSMTP& context, wxSocketEvent& event) const
{
if (event.GetSocketEvent() == wxSOCKET_CONNECTION) {
context.ChangeState(g_connectedState);
} else {
// error
}
}
void ConnectedState::onResponse(wxSMTP& context, int smtpCode) const
{
if (smtpCode == 220) {
context.ChangeState(g_heloState);
// TODO: using some wxWindows function for getting the hostname
context.Write(wxT("HELO localhost\x00d\x00a"));
} else {
// error
}
}
void HeloState::onResponse(wxSMTP& context, int smtpCode) const
{
if (smtpCode == 250) {
context.ChangeState(g_sendMailFromState);
context.SendFrom();
} else {
// error
}
}
void SendMailFromState::onResponse(wxSMTP& context, int smtpCode) const
{
if (smtpCode == 250) {
context.ChangeState(g_rcptListState);
context.SendNextRecipient();
} else {
// error
}
}
void RcptListState::onResponse(wxSMTP& context, int smtpCode) const
{
switch (smtpCode) {
case 250:
case 251:
context.OnRecipientSuccess();
break;
case 421: // service not available
// error
break;
default:
context.OnRecipientError();
}
context.SendNextRecipient();
}
void StartDataState::onResponse(wxSMTP& context, int smtpCode) const
{
if (smtpCode == 354) {
context.ChangeState(g_dataState);
context.SendData();
}
}
void DataState::onResponse(wxSMTP& context, int smtpCode) const
{
if (smtpCode == 250) {
context.OnDataSuccess();
}
}

78
libraries/wxSMTP/states.h Normal file
View File

@ -0,0 +1,78 @@
/*
* Purpose: private wxWindows helper classes for SMTP
* Author: Frank Buß
* Created: 2002
*/
#ifndef STATES_H
#define STATES_H
#include <wx/wx.h>
#include <wx/socket.h>
#include "smtp.h"
class MailState
{
public:
virtual void onConnect(wxSMTP& context, wxSocketEvent& event) const {}
virtual void onResponse(wxSMTP& context, int smtpCode) const {}
};
class InitialState : public MailState
{
public:
void onConnect(wxSMTP& context, wxSocketEvent& event) const ;
};
class ConnectedState : public MailState
{
public:
void onResponse(wxSMTP& context, int smtpCode) const ;
};
class HeloState : public MailState
{
public:
void onResponse(wxSMTP& context, int smtpCode) const ;
};
class SendMailFromState : public MailState
{
public:
void onResponse(wxSMTP& context, int smtpCode) const ;
};
class RcptListState : public MailState
{
public:
void onResponse(wxSMTP& context, int smtpCode) const ;
};
class StartDataState : public MailState
{
public:
void onResponse(wxSMTP& context, int smtpCode) const ;
};
class DataState : public MailState
{
public:
void onResponse(wxSMTP& context, int smtpCode) const ;
};
extern const InitialState g_initialState;
extern const ConnectedState g_connectedState;
extern const HeloState g_heloState;
extern const SendMailFromState g_sendMailFromState;
extern const RcptListState g_rcptListState;
extern const StartDataState g_startDataState;
extern const DataState g_dataState;
#endif

178
libraries/wxSMTP/wino.cpp Normal file
View File

@ -0,0 +1,178 @@
/*
* Purpose: Sample application for demonstrating and testing the wxWindows email support
* Author: Frank Buß
* Created: 2002
*/
#include "wino.h"
#include "snddlg.h"
static const char sccsid[] = "%W% %G%";
#include "wino.xpm"
#include "snddlg.h"
enum {
ID_SEND_BUTTON = 1,
ID_FILE_ADD_BUTTON,
ID_FILE_REMOVE_BUTTON,
ID_ADDRESS_ADD_BUTTON,
ID_ADDRESS_REMOVE_BUTTON
};
BEGIN_EVENT_TABLE(WinoDialog, wxDialog)
EVT_BUTTON(ID_SEND_BUTTON, WinoDialog::OnSendButton)
EVT_BUTTON(ID_FILE_ADD_BUTTON, WinoDialog::OnFileAddButton)
EVT_BUTTON(ID_FILE_REMOVE_BUTTON, WinoDialog::OnFileRemoveButton)
EVT_BUTTON(ID_ADDRESS_ADD_BUTTON, WinoDialog::OnAddressAddButton)
EVT_BUTTON(ID_ADDRESS_REMOVE_BUTTON, WinoDialog::OnAddressRemoveButton)
END_EVENT_TABLE()
IMPLEMENT_APP(WinoApp)
bool WinoApp::OnInit(void)
{
WinoDialog dialog(NULL);
dialog.ShowModal();
return FALSE;
}
#include "base64.h"
WinoDialog::WinoDialog(wxWindow *parent)
: wxDialog(parent, -1,
_("Wino - Wino Is Not Outlook"),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxDIALOG_MODAL)
{
// TODO: save pointers to member variables in delete it in destructor
wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* pServerSizer = new wxBoxSizer(wxHORIZONTAL);
pServerSizer->Add(new wxStaticText(this, -1, "SMTP Server:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pServerTextCtrl = new wxTextCtrl(this, -1);
pServerSizer->Add(m_pServerTextCtrl, 5, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pServerSizer, 0, wxEXPAND);
wxBoxSizer* pFromSizer = new wxBoxSizer(wxHORIZONTAL);
pFromSizer->Add(new wxStaticText(this, -1, "Absender:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pFromTextCtrl = new wxTextCtrl(this, -1);
pFromSizer->Add(m_pFromTextCtrl, 5, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pFromSizer, 0, wxEXPAND);
wxBoxSizer* pToSizer = new wxBoxSizer(wxHORIZONTAL);
pToSizer->Add(new wxStaticText(this, -1, "An:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pToTextCtrl = new wxTextCtrl(this, -1);
pToSizer->Add(m_pToTextCtrl, 5, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pToSizer, 0, wxEXPAND);
wxBoxSizer* pSubjectSizer = new wxBoxSizer(wxHORIZONTAL);
pSubjectSizer->Add(new wxStaticText(this, -1, "Betreff:"), 1, wxALIGN_CENTER | wxLEFT | wxTOP, 10);
m_pSubjectTextCtrl = new wxTextCtrl(this, -1);
pSubjectSizer->Add(m_pSubjectTextCtrl, 5, wxLEFT | wxTOP | wxRIGHT | wxALIGN_RIGHT | wxALIGN_CENTER | wxEXPAND, 10);
pTopSizer->Add(pSubjectSizer, 0, wxEXPAND);
m_pTextTextCtrl = new wxTextCtrl(this, -1, "", wxDefaultPosition, wxSize(100, 200), wxTE_MULTILINE);
pTopSizer->Add(m_pTextTextCtrl, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 10);
// list ctrls
wxBoxSizer* pListsSizer = new wxBoxSizer(wxHORIZONTAL);
wxBoxSizer* pFilelistSizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, "Dateianhänge"), wxVERTICAL);
wxBoxSizer* pFilelistButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
pFilelistButtonsSizer->Add(new wxButton(this, ID_FILE_ADD_BUTTON, "Datei hinzufügen"), 1, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 10);
pFilelistButtonsSizer->Add(new wxButton(this, ID_FILE_REMOVE_BUTTON, "Markierte entfernen"), 1, wxEXPAND | wxALL, 10);
m_pFilelist = new wxListBox(this, -1, wxDefaultPosition, wxSize(50, 50));
pFilelistSizer->Add(m_pFilelist, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 10);
pFilelistSizer->Add(pFilelistButtonsSizer, 0, wxEXPAND);
pListsSizer->Add(pFilelistSizer, 1, wxEXPAND | wxLEFT | wxTOP, 10);
wxBoxSizer* pAddresslistSizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, "Address Manager Dateien"), wxVERTICAL);
wxBoxSizer* pAddresslistButtonsSizer = new wxBoxSizer(wxHORIZONTAL);
pAddresslistButtonsSizer->Add(new wxButton(this, ID_ADDRESS_ADD_BUTTON, "Datei hinzufügen"), 1, wxEXPAND | wxLEFT | wxTOP | wxBOTTOM, 10);
pAddresslistButtonsSizer->Add(new wxButton(this, ID_ADDRESS_REMOVE_BUTTON, "Markierte entfernen"), 1, wxEXPAND | wxALL, 10);
m_pAddresslist = new wxListBox(this, -1, wxDefaultPosition, wxSize(50, 50));
pAddresslistSizer->Add(m_pAddresslist, 0, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 10);
pAddresslistSizer->Add(pAddresslistButtonsSizer, 0, wxEXPAND);
pListsSizer->Add(pAddresslistSizer, 1, wxEXPAND | wxLEFT | wxTOP | wxRIGHT, 10);
pTopSizer->Add(pListsSizer, 0, wxEXPAND);
// send close button
wxBoxSizer* pSendCloseSizer = new wxBoxSizer(wxHORIZONTAL);
pSendCloseSizer->Add(new wxButton(this, ID_SEND_BUTTON, "eMail verschicken"), 0, wxTOP | wxBOTTOM, 10);
wxButton* pCloseButton = new wxButton(this, wxID_CANCEL, "Beenden");
pCloseButton->SetDefault();
pSendCloseSizer->Add(pCloseButton, 0, wxALL, 10);
pTopSizer->Add(pSendCloseSizer, 0, wxALIGN_RIGHT);
SetAutoLayout(true);
SetSizer(pTopSizer);
pTopSizer->Fit(this);
pTopSizer->SetSizeHints(this);
// set some default values for testing
m_pServerTextCtrl->SetValue("merlin"); // my local unix server
m_pSubjectTextCtrl->SetValue("");
m_pTextTextCtrl->SetValue("");
m_pFromTextCtrl->SetValue("fb@frank-buss.de");
m_pToTextCtrl->SetValue("somebody@frank-buss.de");
// show dialog
Centre(wxBOTH | wxCENTRE_ON_SCREEN);
}
WinoDialog::~WinoDialog()
{
}
void WinoDialog::OnSendButton(wxCommandEvent &event)
{
SendDialog dialog(*this);
dialog.ShowModal();
}
void WinoDialog::OnFileAddButton(wxCommandEvent &event)
{
wxFileDialog dialog(this, "Datei Hinzufügen", "", "", "Alle Dateien (*)|*", wxOPEN);
if (dialog.ShowModal() == wxID_OK) {
wxFileName* pFilename = new wxFileName(dialog.GetPath());
m_pFilelist->Append(pFilename->GetFullName(), pFilename);
}
}
void WinoDialog::OnFileRemoveButton(wxCommandEvent &event)
{
int sel = m_pFilelist->GetSelection();
if (sel != -1) {
wxFileName* pFilename = (wxFileName*) m_pFilelist->GetClientData(sel);
m_pFilelist->Delete(sel);
delete pFilename;
}
}
void WinoDialog::OnAddressAddButton(wxCommandEvent &event)
{
wxFileDialog dialog(this, "Address Manager Datei Empfängerliste Hinzufügen", "", "", "Address Manager Dateien (*.adm)|*.adm", wxOPEN);
if (dialog.ShowModal() == wxID_OK) {
wxFileName* pFilename = new wxFileName(dialog.GetPath());
m_pAddresslist->Append(pFilename->GetFullName(), pFilename);
}
}
void WinoDialog::OnAddressRemoveButton(wxCommandEvent &event)
{
int sel = m_pAddresslist->GetSelection();
if (sel != -1) {
wxFileName* pFilename = (wxFileName*) m_pAddresslist->GetClientData(sel);
m_pAddresslist->Delete(sel);
delete pFilename;
}
}

54
libraries/wxSMTP/wino.h Normal file
View File

@ -0,0 +1,54 @@
/*
* Purpose: Sample application for demonstrating and testing the wxWindows email support
* Author: Frank Buß
* Created: 2002
*/
#ifndef WINO_H
#define WINO_H
#include <wx/wx.h>
#include <wx/listctrl.h>
#if !defined(__WXMSW__)
extern char* wino_xpm[];
#endif
class WinoApp : public wxApp
{
public:
bool OnInit();
};
class WinoDialog : public wxDialog
{
public:
WinoDialog(wxWindow *parent);
~WinoDialog();
void OnSendButton(wxCommandEvent &event);
void OnFileAddButton(wxCommandEvent &event);
void OnFileRemoveButton(wxCommandEvent &event);
void OnAddressAddButton(wxCommandEvent &event);
void OnAddressRemoveButton(wxCommandEvent &event);
private:
wxTextCtrl* m_pServerTextCtrl;
wxTextCtrl* m_pFromTextCtrl;
wxTextCtrl* m_pToTextCtrl;
wxTextCtrl* m_pSubjectTextCtrl;
wxTextCtrl* m_pTextTextCtrl;
wxListBox* m_pFilelist;
wxListBox* m_pAddresslist;
DECLARE_EVENT_TABLE()
friend class SendDialog;
};
#endif

117
libraries/wxSMTP/wxsmtp.sln Normal file
View File

@ -0,0 +1,117 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.34930.48
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wxsmtp", "wxsmtp.vcxproj", "{ECA5FC4D-29CE-5030-9175-551834BF6CB0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
DLL ANSI Debug Monolithic|Win32 = DLL ANSI Debug Monolithic|Win32
DLL ANSI Debug Multilib|Win32 = DLL ANSI Debug Multilib|Win32
DLL ANSI Release Monolithic|Win32 = DLL ANSI Release Monolithic|Win32
DLL ANSI Release Multilib|Win32 = DLL ANSI Release Multilib|Win32
DLL Debug|Win32 = DLL Debug|Win32
DLL Release|Win32 = DLL Release|Win32
DLL Unicode Debug Monolithic|Win32 = DLL Unicode Debug Monolithic|Win32
DLL Unicode Debug Multilib|Win32 = DLL Unicode Debug Multilib|Win32
DLL Unicode Debug|Win32 = DLL Unicode Debug|Win32
DLL Unicode Release Monolithic|Win32 = DLL Unicode Release Monolithic|Win32
DLL Unicode Release Multilib|Win32 = DLL Unicode Release Multilib|Win32
DLL Unicode Release|Win32 = DLL Unicode Release|Win32
DLL Universal Debug|Win32 = DLL Universal Debug|Win32
DLL Universal Release|Win32 = DLL Universal Release|Win32
DLL Universal Unicode Debug|Win32 = DLL Universal Unicode Debug|Win32
DLL Universal Unicode Release|Win32 = DLL Universal Unicode Release|Win32
Release|Win32 = Release|Win32
Static ANSI Debug Monolithic|Win32 = Static ANSI Debug Monolithic|Win32
Static ANSI Debug Multilib|Win32 = Static ANSI Debug Multilib|Win32
Static ANSI Release Monolithic|Win32 = Static ANSI Release Monolithic|Win32
Static ANSI Release Multilib|Win32 = Static ANSI Release Multilib|Win32
Static Unicode Debug Monolithic|Win32 = Static Unicode Debug Monolithic|Win32
Static Unicode Debug Multilib|Win32 = Static Unicode Debug Multilib|Win32
Static Unicode Release Monolithic|Win32 = Static Unicode Release Monolithic|Win32
Static Unicode Release Multilib|Win32 = Static Unicode Release Multilib|Win32
Template|Win32 = Template|Win32
Unicode Debug|Win32 = Unicode Debug|Win32
Unicode Release|Win32 = Unicode Release|Win32
Universal Debug|Win32 = Universal Debug|Win32
Universal Release|Win32 = Universal Release|Win32
Universal Unicode Debug|Win32 = Universal Unicode Debug|Win32
Universal Unicode Release|Win32 = Universal Unicode Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Debug|Win32.ActiveCfg = Static Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Debug|Win32.Build.0 = Static Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Debug Monolithic|Win32.ActiveCfg = DLL ANSI Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Debug Monolithic|Win32.Build.0 = DLL ANSI Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Debug Multilib|Win32.ActiveCfg = DLL ANSI Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Debug Multilib|Win32.Build.0 = DLL ANSI Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Release Monolithic|Win32.ActiveCfg = DLL ANSI Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Release Monolithic|Win32.Build.0 = DLL ANSI Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Release Multilib|Win32.ActiveCfg = DLL ANSI Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL ANSI Release Multilib|Win32.Build.0 = DLL ANSI Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Debug|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Debug|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Release|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Release|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Debug Monolithic|Win32.ActiveCfg = DLL Unicode Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Debug Monolithic|Win32.Build.0 = DLL Unicode Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Debug Multilib|Win32.ActiveCfg = DLL Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Debug Multilib|Win32.Build.0 = DLL Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Debug|Win32.ActiveCfg = DLL Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Debug|Win32.Build.0 = DLL Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Release Monolithic|Win32.ActiveCfg = DLL Unicode Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Release Monolithic|Win32.Build.0 = DLL Unicode Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Release Multilib|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Release Multilib|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Release|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Unicode Release|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Debug|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Debug|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Release|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Release|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Unicode Debug|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Unicode Debug|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Unicode Release|Win32.ActiveCfg = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.DLL Universal Unicode Release|Win32.Build.0 = DLL Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Release|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Release|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Debug Monolithic|Win32.ActiveCfg = Static ANSI Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Debug Monolithic|Win32.Build.0 = Static ANSI Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Debug Multilib|Win32.ActiveCfg = Static ANSI Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Debug Multilib|Win32.Build.0 = Static ANSI Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Release Monolithic|Win32.ActiveCfg = Static ANSI Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Release Monolithic|Win32.Build.0 = Static ANSI Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Release Multilib|Win32.ActiveCfg = Static ANSI Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static ANSI Release Multilib|Win32.Build.0 = Static ANSI Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Debug Monolithic|Win32.ActiveCfg = Static Unicode Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Debug Monolithic|Win32.Build.0 = Static Unicode Debug Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Debug Multilib|Win32.ActiveCfg = Static Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Debug Multilib|Win32.Build.0 = Static Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Release Monolithic|Win32.ActiveCfg = Static Unicode Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Release Monolithic|Win32.Build.0 = Static Unicode Release Monolithic|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Release Multilib|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Static Unicode Release Multilib|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Template|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Template|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Unicode Debug|Win32.ActiveCfg = Static Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Unicode Debug|Win32.Build.0 = Static Unicode Debug Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Unicode Release|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Unicode Release|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Debug|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Debug|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Release|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Release|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Unicode Debug|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Unicode Debug|Win32.Build.0 = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Unicode Release|Win32.ActiveCfg = Static Unicode Release Multilib|Win32
{ECA5FC4D-29CE-5030-9175-551834BF6CB0}.Universal Unicode Release|Win32.Build.0 = Static Unicode Release Multilib|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3EF6ACB4-F0B8-4360-9E31-87F7891CCCEE}
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Headers">
<UniqueIdentifier>{0b9dfa36-5e19-4996-99a3-f8db11300859}</UniqueIdentifier>
</Filter>
<Filter Include="Sources">
<UniqueIdentifier>{14ba8cad-ddd9-476d-ab91-87c47dd00807}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="smtp.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="states.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="cmdprot.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="email.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="mime.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="base64.h">
<Filter>Headers</Filter>
</ClInclude>
<ClInclude Include="dllimpexp.h">
<Filter>Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="smtp.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="states.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="email.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="mime.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="cmdprot.cpp">
<Filter>Sources</Filter>
</ClCompile>
<ClCompile Include="base64.cpp">
<Filter>Sources</Filter>
</ClCompile>
</ItemGroup>
</Project>

9
src/ba/ba0100m.h Normal file
View File

@ -0,0 +1,9 @@
#define F_SERVER 101
#define F_PORT 102
#define F_TYPE 103
#define F_MUSR 104
#define F_MPWD 105
#define F_FROM 106
#define F_RETRY 107
#define F_FIRM 108
#define F_CCN 109