Click here to Skip to main content
12,504,695 members (63,105 online)
Click here to Skip to main content
Add your own
alternative version

Stats

327K views
2 downloads
106 bookmarked
Posted

CFastSmtp - Fast and easy SMTP class...

, 4 Sep 2002
Rate this:
Please Sign up or sign in to vote.
Fast and simple win32 SMTP class with handy local ip/name funtions

Introduction

zSmtp v1.1

Win32 SMTP Wrapper with handy local ip and hostname functions.

Notes

A real basic SMTP wrapper. I tried to find one, but I couldn't - so here is another one. It is fast and straight forward - just instantiate the class with a SMTP server and then set the sender email property and message body. The rest of the settings are pretty much optional. There are also a couple of nice utility functions for getting your local hostname and local ip address.

We hope this code helps you out!

To Do

  • UUEncode/Decode
  • Attachments

Usage

CFastSmtp mail;

if (mail.ConnectServer("SERVER")) {
    mail.SetSenderName("Sender's Name");
    mail.SetSenderEmail("senders@address.com");
    mail.SetSubject("CFastSmtp v1.1 Release");

    mail.AddRecipient("test@test.com");
    mail.AddCCRecipient("test@test.com");
    mail.AddBCCRecipient("test@test.com");

    mail.SetMessageBody("Here is another test of CFastSmtp SMTP class!");
    
    if (mail.GetConnectStatus()) {        
        printf(mail.Send() ? "Send was a success!" : "Send failed!");
        mail.Disconnect();                    
    }
}   

Source Code

Here is the source (FastSmtp.cpp):

//********************************************************************
/*
  Fast & Simple SMTP Class

  Author:
    christopher w. backen <immortal@cox.net>    
  Purpose:
    Simple smtp class with handy local ip and hostname functions
  ToDo:
    Attachments & UUEncode/Decode
*/
//********************************************************************
//*** Change History
//*** DEVELOPER             DATE        MODIFICATION
//*** 
//*** christopher w. backen 09.05.2002    Misc. updates and corrections
//*** christopher w. backen    08.28.2001    Bug fixes & code changes
//*** christopher w. backen    04.12.2001    Release
//***
//********************************************************************



#include "stdafx.h"
#include "FastSmtp.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CFastSmtp::CFastSmtp()
{
    // Initialize variables
    bCon            = false;

    m_pcFromEmail    = NULL;
    m_pcFromName    = NULL;
    m_pcSubject        = NULL;
    m_pcMsgBody        = NULL;
    m_pcXMailer        = NULL;
    m_pcReplyTo        = NULL;
    m_pcIPAddr        = NULL;

    // Initialize WinSock
    WORD wVer    = MAKEWORD(2,2);    
    if (WSAStartup(wVer,&wsaData) != NO_ERROR) {
        printf("WSAStartup %d\r\n", WSAGetLastError());        
        throw; 
    }
    if (LOBYTE( wsaData.wVersion ) != 2 || HIBYTE( wsaData.wVersion ) != 2 ) {
        printf("Can't find a useable WinSock DLL\r\n");
        WSACleanup();
        throw; 
    }    
}

CFastSmtp::~CFastSmtp()
{
    // Free recipient lists
    for (unsigned int n = 0; n < Recipients.size(); n++)
        delete Recipients[n];
    for (unsigned int n = 0; n < CCRecipients.size(); n++)
        delete CCRecipients[n];
    for (unsigned int n = 0; n < BCCRecipients.size(); n++)
        delete BCCRecipients[n];

    // Free variables
    if (m_pcFromEmail)
        delete m_pcFromEmail;
    if (m_pcFromName)
        delete m_pcFromName;
    if (m_pcSubject)
        delete m_pcSubject;
    if (m_pcMsgBody)
        delete m_pcMsgBody;
    if (m_pcXMailer)
        delete m_pcXMailer;
    if (m_pcReplyTo)
        delete m_pcReplyTo;

    // Close connection
    if (bCon)
        Disconnect();

    // Cleanup
    WSACleanup();
}

bool CFastSmtp::AddRecipient(const char email[], const char name[])
{
    assert(email);

    int s=strlen(email);
    if (s==0)
        return false;

    CRecipient *pRec = new CRecipient();

    char *pcBuf = new char[s+strlen(name)+4];
     sprintf(pcBuf,"%s<%s>",name,email);    
     pRec->SetEmail(pcBuf);
     Recipients.insert(Recipients.end(), pRec);
    delete pcBuf;

    return (true);    
}

bool CFastSmtp::AddCCRecipient(const char email[], const char name[])
{
    assert(email);

    int s=strlen(email);
    if (s==0)
        return false;

    CRecipient *pRec = new CRecipient();    

    char *pcBuf = new char[s+strlen(name)+4];
     sprintf(pcBuf,"%s<%s>",name,email);    
     pRec->SetEmail(pcBuf);
     CCRecipients.insert(CCRecipients.end(), pRec);
    delete pcBuf;

    return (true);
}

bool CFastSmtp::AddBCCRecipient(const char email[], const char name[])
{
    assert(email);

    int s=strlen(email);
    if (s==0)
        return false;

    CRecipient *pRec = new CRecipient();

    char *pcBuf = new char[s+strlen(name)+4];
     sprintf(pcBuf,"%s<%s>",name,email);    
     pRec->SetEmail(pcBuf);
     BCCRecipients.insert(BCCRecipients.end(), pRec);
    delete pcBuf;    
    
    return (true);
}

bool CFastSmtp::Disconnect()
{
    if (!bCon) {
        printf("Not connected to server!\r\n");
        return (false);
    }

    BYTE        sReceiveBuffer[4096];
    int            iLength = 0;
    int            iEnd = 0;

    if (send(hSocket, (LPSTR)"QUIT\r\n", strlen("QUIT\r\n"),
             NO_FLAGS) == SOCKET_ERROR) {
        printf("Socket send error: %d\r\n", WSAGetLastError());    
        return (false);
    }
    iLength = recv(hSocket, (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd, 
                   NO_FLAGS);
    iEnd += iLength;
    sReceiveBuffer[iEnd] = '\0';

    bCon=false;    

    hSocket=NULL;

    return (true);
}

bool CFastSmtp::Send()
{
// verify sender email
    if (m_pcFromEmail == NULL) {
        printf("Please specifiy a sender email address\r\n");
        return (false);
    }

    BYTE        sReceiveBuffer[4096];
    int            iLength = 0;
    int            iEnd = 0;
    char        buf[4096];
// get proper header
    char* msgHeader = _formatHeader();

    if (msgHeader == NULL) {
        delete [] msgHeader;
        printf("Failed to format message header\r\n");
        return (false);
    }
// start
    strcpy(buf, "MAIL FROM: <");
    strcat(buf, m_pcFromEmail);
    strcat(buf, ">\r\n");
    if (send(hSocket, (LPSTR)buf, strlen(buf), NO_FLAGS) == SOCKET_ERROR) {
        printf("Socket send error: %d\r\n", WSAGetLastError());    
        return (false);
    }
    iLength = recv(hSocket, (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd, 
                   NO_FLAGS);
    iEnd += iLength;
    sReceiveBuffer[iEnd] = '\0';
// create message receipts
    char *token;
    for(unsigned int i=0;i<Recipients.size();i++) {
        token = strtok(Recipients.at(i)->GetEmail(),"<");
        token = strtok(NULL,"<");    
        if (token == NULL) 
            token = strtok(Recipients.at(i)->GetEmail(),"<");
        strcpy(buf, "RCPT TO: <");
        strcat(buf, token);
        strcat(buf, "\r\n");
        if (send(hSocket, (LPSTR)buf, strlen(buf), NO_FLAGS) == SOCKET_ERROR) {
            printf("Socket send error: %d\r\n", WSAGetLastError());    
            return (false);
        }
        iLength = recv(hSocket, 
                      (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd, 
                       NO_FLAGS);
        iEnd += iLength;
        sReceiveBuffer[iEnd] = '\0';
    }
    for(unsigned int i=0;i<CCRecipients.size();i++) {
        token = strtok(CCRecipients.at(i)->GetEmail(),"<");
        token = strtok(NULL,"<");
        if (token == NULL) 
            token = strtok(Recipients.at(i)->GetEmail(),"<");
        strcpy(buf, "RCPT TO: <");
        strcat(buf, token);
        strcat(buf, "\r\n");
        if (send(hSocket, (LPSTR)buf, strlen(buf), NO_FLAGS) == SOCKET_ERROR) {
            printf("Socket send error: %d\r\n", WSAGetLastError());    
            return (false);
        }
        iLength = recv(hSocket, 
                       (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd,
                        NO_FLAGS);
        iEnd += iLength;
        sReceiveBuffer[iEnd] = '\0';
    }
    for(unsigned int i=0;i<BCCRecipients.size();i++) {
        token = strtok(BCCRecipients.at(i)->GetEmail(),"<");
        token = strtok(NULL,"<");
        if (token == NULL) 
            token = strtok(Recipients.at(i)->GetEmail(),"<");
        strcpy(buf, "RCPT TO: <");
        strcat(buf, token);
        strcat(buf, "\r\n");
        if (send(hSocket, (LPSTR)buf, strlen(buf), NO_FLAGS) == SOCKET_ERROR) {
            printf("Socket send error: %d\r\n", WSAGetLastError());    
            return (false);
        }
        iLength = recv(hSocket, (LPSTR)sReceiveBuffer+iEnd,
                       sizeof(sReceiveBuffer)-iEnd, 
                       NO_FLAGS);
        iEnd += iLength;
        sReceiveBuffer[iEnd] = '\0';
    }
// init data
    if (send(hSocket, (LPSTR)"DATA\r\n", strlen("DATA\r\n"), NO_FLAGS) == SOCKET_ERROR) {
        printf("Socket send error: %d\r\n", WSAGetLastError());    
        return (false);
    }
    iLength = recv(hSocket, (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd,
                   NO_FLAGS);
    iEnd += iLength;
    sReceiveBuffer[iEnd] = '\0';
// send header    
    if (send(hSocket, 
             (LPSTR)msgHeader, strlen(msgHeader), NO_FLAGS) == SOCKET_ERROR) {
        printf("Socket send error: %d\r\n", WSAGetLastError());    
        delete [] msgHeader;
        return (false);
    }
// send body    
    if (send(hSocket, 
             (LPSTR)m_pcMsgBody, strlen(m_pcMsgBody), NO_FLAGS) == SOCKET_ERROR) {
        printf("Socket send error: %d\r\n", WSAGetLastError());    
        return (false);
    }
// signal end    
    if (send(hSocket,
            (LPSTR)"\r\n.\r\n", strlen("\r\n.\r\n"), NO_FLAGS) == SOCKET_ERROR) {
        printf("Socket send error: %d\r\n", WSAGetLastError());    
        return (false);
    }
    iLength = recv(hSocket, (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd,
                   NO_FLAGS);
    iEnd += iLength;
    sReceiveBuffer[iEnd] = '\0';
    delete [] msgHeader;
    return (true);

}

bool CFastSmtp::ConnectServer(const char server[], const unsigned short port)
{
    assert(server);

    if (bCon)
        Disconnect();
    bCon=false;
    hSocket = INVALID_SOCKET;

    hSocket = _connectServerSocket(server, port);    
    if (hSocket != INVALID_SOCKET) {        
        BYTE        sReceiveBuffer[4096];
        int            iLength = 0;
        int            iEnd = 0;
        char        buf[4096];
      
        strcpy(buf, "HELO ");
        strcat(buf, server);
        strcat(buf, "\r\n");
        if (send(hSocket, (LPSTR)buf, strlen(buf), NO_FLAGS) == SOCKET_ERROR) {
            printf("Socket send error: %d\r\n", WSAGetLastError());    
            return (false);
        }
        iLength = recv(hSocket, 
                       (LPSTR)sReceiveBuffer+iEnd,sizeof(sReceiveBuffer)-iEnd, 
                        NO_FLAGS);
        iEnd += iLength;
        sReceiveBuffer[iEnd] = '\0';
    } else {
        printf("Invalid socket\r\n");
        return (false);
    }

    bCon=true;
    return (true);
}

SOCKET CFastSmtp::_connectServerSocket(const char server[],
                                       const unsigned short port)
{
    int                nConnect;
    short            nProtocolPort;
    LPHOSTENT        lpHostEnt;
    LPSERVENT        lpServEnt;
    SOCKADDR_IN        sockAddr;        

    SOCKET            hServerSocket = INVALID_SOCKET;
     
    lpHostEnt = gethostbyname(server);
    if (lpHostEnt) {        
        hServerSocket = socket(PF_INET, SOCK_STREAM,DEFAULT_PROTOCOL);
        if (hServerSocket != INVALID_SOCKET) {
            if (port != NULL) {
                nProtocolPort = port;
            }else{
                lpServEnt = getservbyname("mail", DEFAULT_PROTOCOL);
                if (lpServEnt == NULL) 
                    nProtocolPort = htons(IPPORT_SMTP); 
                else 
                    nProtocolPort = lpServEnt->s_port;
            }
            sockAddr.sin_family = AF_INET;
            sockAddr.sin_port = nProtocolPort;
            sockAddr.sin_addr = *((LPIN_ADDR)*lpHostEnt->h_addr_list);
            nConnect = connect(hServerSocket, (PSOCKADDR)&sockAddr, 
                               sizeof(sockAddr));
            if(nConnect) 
                hServerSocket = INVALID_SOCKET;
        } else {
            printf("Invalid socket\r\n");
            throw;
        }
    }
    return(hServerSocket);
}

char* CFastSmtp::_formatHeader()
{
// check for at least one recipient
    if(Recipients.size() <= 0 )    {
        printf("Please add a message recipient!\r\n");
        return NULL;
    }
    int s=0;
    char *msgHeader = new char[16385];
    //char to[1024];
    for (unsigned int i=s=0;i<Recipients.size();i++) {        
        s+=strlen(Recipients.at(i)->GetEmail())+1;
    } if (s==0) s=1; char *to = new char[s];
    //char cc[1024];
    for (i=s=0;i<CCRecipients.size();i++) {        
        s+=strlen(CCRecipients.at(i)->GetEmail())+1;
    } if (s==0) s=1; char *cc = new char[s];
    //char bcc[1024];
    for (i=s=0;i<BCCRecipients.size();i++) {        
        s+=strlen(BCCRecipients.at(i)->GetEmail())+1;
    } if (s==0) s=1; char *bcc = new char[s];

    TCHAR szDate[500];
    TCHAR sztTime[500];

// create the recipient string, cc string, and bcc string
    to[0] = '\0';        
    for (i=0;i<Recipients.size();i++) {        
        i > 0 ? strcat(to,","):strcat(to,"");
        strcat(to,Recipients.at(i)->GetEmail());
    }

    cc[0] = '\0';    
    for (i=0;i<CCRecipients.size();i++) {
        i > 0 ? strcat(cc,","):strcat(cc,"");
        strcat(cc,CCRecipients.at(i)->GetEmail());
    }

    bcc[0] = '\0';    
    for (i=0;i<BCCRecipients.size();i++) {
        i > 0 ? strcat(bcc,","):strcat(bcc,"");
        strcat(bcc,BCCRecipients.at(i)->GetEmail());
    }
// get the current date and time
    SYSTEMTIME st={0};
    ::GetSystemTime(&st);
    ::GetDateFormat(LOCALE_SYSTEM_DEFAULT,0,&st,"ddd',
                    ' dd MMM yyyy",szDate,sizeof(szDate));
    ::GetTimeFormat(LOCALE_SYSTEM_DEFAULT,TIME_FORCE24HOURFORMAT,&st,
                    "HH':'mm':'ss tt",sztTime,sizeof(sztTime));
// here it is...the main data of the message
    wsprintf(msgHeader,"DATE: %s %s\r\n", szDate, sztTime);    
    if (m_pcFromName != NULL) {
        strcat(msgHeader,"FROM: ");
        strcat(msgHeader, m_pcFromName);
        strcat(msgHeader, "\r\n");
    }
    strcat(msgHeader,"To: ");
    strcat(msgHeader, to);
    strcat(msgHeader, "\r\n");
    strcat(msgHeader,"Cc: ");
    strcat(msgHeader, cc);
    strcat(msgHeader, "\r\n");
    if (m_pcSubject != NULL) {
        strcat(msgHeader, "Subject: ");
        strcat(msgHeader, m_pcSubject);
        strcat(msgHeader, "\r\n");
    }
    if (m_pcXMailer != NULL) {
        strcat(msgHeader,"X-Mailer: ");
        strcat(msgHeader, m_pcXMailer);
        strcat(msgHeader, "\r\n");
    }
// start optional fields
    if (m_pcReplyTo != NULL) {
        strcat(msgHeader, "Reply-To: ");
        strcat(msgHeader, m_pcReplyTo);
        strcat(msgHeader, "\r\n");
    }
// start MIME versions
    strcat(msgHeader, 
           "MIME-Version: 1.0\r\nContent-type: text/plain; charset=US-ASCII\r\n");
// send header finish command
    strcat(msgHeader, "\r\n");    
// clean up
    delete to;
    delete cc;
    delete bcc;
// done    
    return msgHeader;    
}

const char* const CFastSmtp::GetLocalHostIp() 
{
    in_addr    *iaHost;
    
    if (gethostname(m_cHostName,255) != SOCKET_ERROR) {
        HOSTENT *pHe = NULL;        
        pHe = gethostbyname(m_cHostName);
        if (pHe != NULL) {
            for (int i=0;pHe->h_addr_list[i] != 0;i++) {
                iaHost = (LPIN_ADDR)pHe->h_addr_list[i];
                m_pcIPAddr = inet_ntoa(*iaHost);
            }
        }            
    } else {            
        DWORD dErr = WSAGetLastError();    
        printf("Failed to get the local ip address\r\n");
    }    

    return m_pcIPAddr;
}

const char* const CFastSmtp::GetLocalHostname() 
{    
    if (gethostname((char FAR*)m_cHostName,255) == SOCKET_ERROR)    
        printf("Failed to get the local hostname\r\n");
    return m_cHostName;
}


//**********************************************************************************
//*** Properties
//**********************************************************************************

bool CFastSmtp::GetConnectStatus()
{
    return (bCon);
}

unsigned const int CFastSmtp::GetBCCRecipientCount()
{
    return (BCCRecipients.size());
}

unsigned const int CFastSmtp::GetCCRecipientCount() 
{
    return (CCRecipients.size());
}

unsigned const int CFastSmtp::GetSocket()
{
    return (hSocket);
}

const char* const CFastSmtp::GetMessageBody() 
{
    return (m_pcMsgBody);
}

unsigned const int CFastSmtp::GetRecipientCount()
{
    return (Recipients.size());
}

const char* const CFastSmtp::GetReplyTo()  
{
    return (m_pcReplyTo);
}

const char* const CFastSmtp::GetSenderEmail() 
{
    return (m_pcFromEmail);
}

const char* const CFastSmtp::GetSenderName() 
{
    return (m_pcFromName);
}

const char* const CFastSmtp::GetSubject() 
{
    return (m_pcSubject);
}

const char* const CFastSmtp::GetXMailer() 
{
    return (m_pcXMailer);
}

void CFastSmtp::SetMessageBody(const char body[])
{
    assert(body);
    int s=strlen(body);
    if (m_pcMsgBody)
        delete [] m_pcMsgBody;
    m_pcMsgBody = new char[s+1];
    strcpy(m_pcMsgBody, body);    
}

void CFastSmtp::SetReplyTo(const char replyto[])
{
    assert(replyto);
    int s=strlen(replyto);
    if (m_pcReplyTo)
        delete [] m_pcReplyTo;
    m_pcReplyTo = new char[s+1];
    strcpy(m_pcReplyTo, replyto);
}

void CFastSmtp::SetSenderEmail(const char email[])
{
    assert(email);
    int s=strlen(email);
    if (m_pcFromEmail)
        delete [] m_pcFromEmail;
    m_pcFromEmail = new char[s+1];
    strcpy(m_pcFromEmail, email);        
}

void CFastSmtp::SetSenderName(const char name[])
{
    assert(name);
    int s=strlen(name);
    if (m_pcFromName)
        delete [] m_pcFromName;
    m_pcFromName = new char[s+1];
    strcpy(m_pcFromName, name);
}

void CFastSmtp::SetSubject(const char subject[])
{
    assert(subject);
    int s=strlen(subject);
    if (m_pcSubject)
        delete [] m_pcSubject;
    m_pcSubject = new char[s+1];
    strcpy(m_pcSubject, subject);
}

void CFastSmtp::SetXMailer(const char xmailer[])
{
    assert(xmailer);
    int s=strlen(xmailer);
    if (m_pcXMailer)
        delete [] m_pcXMailer;
    m_pcXMailer = new char[s+1];
    strcpy(m_pcXMailer, xmailer);
}
Here is the header (FastSmtp.h):
// CFastSmtp.h: interface for the Smtp class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SMTP_H__C66CDD0A_4F6F_4465_BAD6_8FA531785B5D__INCLUDED_)
#define AFX_SMTP_H__C66CDD0A_4F6F_4465_BAD6_8FA531785B5D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <winsock2.h>
#include <assert.h>
#include <vector>

const int DEFAULT_PROTOCOL = 0;
const int NO_FLAGS = 0;

class CFastSmtp  
{
public:        
    CFastSmtp();    
    virtual ~CFastSmtp();
    bool    AddRecipient(const char email[], const char name[]="");
    bool    AddBCCRecipient(const char email[], const char name[]="");
    bool    AddCCRecipient(const char email[], const char name[]="");    
    bool    ConnectServer(const char server[], const unsigned short port=NULL);
    bool    Disconnect();
    bool    GetConnectStatus();    
    const unsigned int    GetBCCRecipientCount();    
    const unsigned int    GetCCRecipientCount();
    const unsigned int    GetRecipientCount();    
    const unsigned int    GetSocket();
    const char*    const    GetLocalHostIp();
    const char*    const    GetLocalHostname();    
    const char*    const    GetMessageBody();    
    const char*    const    GetReplyTo();
    const char*    const    GetSenderEmail();
    const char*    const    GetSenderName();
    const char*    const    GetSubject();    
    const char*    const    GetXMailer();    
    bool    Send();
    void    SetMessageBody(const char body[]);    
    void    SetSubject(const char subject[]);    
    void    SetSenderName(const char name[]);    
    void    SetSenderEmail(const char email[]);    
    void    SetReplyTo(const char replyto[]);    
    void    SetXMailer(const char xmailer[]);

private:
    class CRecipient
    {
    public:
        CRecipient() 
        { 
            m_pcEmail = NULL;
        };
        CRecipient& operator=(const CRecipient& src)
        {
            if (&src != this)
            {
                if (m_pcEmail)
                    delete [] m_pcEmail;
                int s = strlen(src.m_pcEmail);
                m_pcEmail = new char[s+1];
                strcpy(m_pcEmail, src.m_pcEmail);
            }
            return (*this);
        };
        virtual ~CRecipient()
        {
            if (m_pcEmail)
                delete [] m_pcEmail;
        };
        char* GetEmail()
        {
            return m_pcEmail;
        };
        void SetEmail(const char email[])
        {
            assert(email);
            int s=strlen(email);
            if (s > 0)
            {
                m_pcEmail = new char[s+1];
                strcpy(m_pcEmail, email);
            }        
        };
    private:
        char *m_pcEmail;
    };
    bool bCon;
    char m_cHostName[MAX_PATH];
    char* m_pcFromEmail;
    char* m_pcFromName;
    char* m_pcSubject;
    char* m_pcMsgBody;
    char* m_pcXMailer;
    char* m_pcReplyTo;
    char* m_pcIPAddr;    

    WSADATA wsaData;
    SOCKET hSocket;

    std::vector<CRecipient*> Recipients;
    std::vector<CRecipient*> CCRecipients;
    std::vector<CRecipient*> BCCRecipients;    
    
    char*   _formatHeader();    
    bool    _formatMessage();
    SOCKET  _connectServerSocket(const char* server, const unsigned short port=NULL);    
};

#endif // !defined(AFX_SMTP_H__C66CDD0A_4F6F_4465_BAD6_8FA531785B5D__INCLUDED_)

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Christopher W. Backen
United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

 
QuestionProblem in connecting the socket Pin
Rocky_Bas8-May-13 20:34
memberRocky_Bas8-May-13 20:34 
Bugclosesocket never called Pin
Martin Chapman30-Nov-11 14:16
memberMartin Chapman30-Nov-11 14:16 
Questiondoes not work, why ? Pin
ghostbuster1216-Aug-10 9:58
memberghostbuster1216-Aug-10 9:58 
GeneralMy vote of 5 Pin
Member 432084420-Jul-10 22:46
memberMember 432084420-Jul-10 22:46 
Generalsocket error 10051 - WSAENETUNREACH Pin
kispo915-Apr-10 23:01
memberkispo915-Apr-10 23:01 
General[My vote of 2] I am not able to get a valid connection Pin
Adriana Aragri28-Jun-09 21:50
memberAdriana Aragri28-Jun-09 21:50 
GeneralRe: [My vote of 2] I am not able to get a valid connection Pin
knestel29-Jul-09 2:12
memberknestel29-Jul-09 2:12 
GeneralMy vote of 1 Pin
Ahmed Han8-Jun-09 20:44
memberAhmed Han8-Jun-09 20:44 
GeneralMy vote of 1 Pin
Menuki28-Apr-09 1:22
memberMenuki28-Apr-09 1:22 
GeneralRe: My vote of 1 Pin
Ahmed Han8-Jun-09 20:46
memberAhmed Han8-Jun-09 20:46 
GeneralBug with CC and BCC recipients... Pin
Menuki28-Apr-09 1:03
memberMenuki28-Apr-09 1:03 
GeneralThanks a lot Pin
General Diensten12-Jun-08 0:14
memberGeneral Diensten12-Jun-08 0:14 
Generalpossinle error by reason of incorrect locale settings Pin
intser12-Feb-08 6:08
memberintser12-Feb-08 6:08 
GeneralComplies well but don't get work Pin
AmitJPatil26-Sep-07 3:39
memberAmitJPatil26-Sep-07 3:39 
GeneralRe: Complies well but don't get work Pin
qqwwwee5-Dec-07 16:41
memberqqwwwee5-Dec-07 16:41 
Questionavailable for VS.NET? Pin
wachaca8-Aug-07 3:58
memberwachaca8-Aug-07 3:58 
AnswerRe: available for VS.NET? Pin
VEMS30-Aug-07 2:15
memberVEMS30-Aug-07 2:15 
GeneralAMAZING Pin
MrGoodly26-Jul-07 2:52
memberMrGoodly26-Jul-07 2:52 
Questionhi, My Code is not work... [modified] Pin
nsh_enp24-May-07 21:52
membernsh_enp24-May-07 21:52 
QuestionSame question as Ahsan has Pin
TongGao Tang20-Feb-07 20:32
memberTongGao Tang20-Feb-07 20:32 
AnswerRe: Same question as Ahsan has Pin
TongGao Tang4-Mar-07 9:49
memberTongGao Tang4-Mar-07 9:49 
GeneralExcellent Work.. Pin
flippydeflippydebop19-Feb-07 22:03
memberflippydeflippydebop19-Feb-07 22:03 
GeneralSmall bug Pin
kaponka4-Sep-06 21:52
memberkaponka4-Sep-06 21:52 
GeneralAgain, the quality Pin
waldermort29-Aug-06 19:52
memberwaldermort29-Aug-06 19:52 
GeneralCode quality Pin
cozy dude13-Apr-06 5:51
membercozy dude13-Apr-06 5:51 
GeneralWorks for me but small fix Pin
chris17510-Apr-06 0:33
memberchris17510-Apr-06 0:33 
Generalvery upset,I can't use the code correctly.... Pin
daveice4-Mar-06 23:12
memberdaveice4-Mar-06 23:12 
GeneralSome ISSUES/QUERIES Pin
Ahsan|nashA11-Jan-06 19:09
memberAhsan|nashA11-Jan-06 19:09 
GeneralRe: Some ISSUES/QUERIES Pin
TongGao Tang4-Mar-07 9:45
memberTongGao Tang4-Mar-07 9:45 
QuestionPossible bug? Pin
nismael21-Sep-05 5:25
membernismael21-Sep-05 5:25 
GeneralThank you (Code with AUTH LOGIN) Pin
jrivero16-Aug-05 13:50
memberjrivero16-Aug-05 13:50 
GeneralSend a file Pin
rbpkirow9-Aug-05 0:25
memberrbpkirow9-Aug-05 0:25 
GeneralAddRecipient, AddCCRecipient and AddBCCRecipient leaks detected!! Pin
Ell14-Feb-05 21:22
memberEll14-Feb-05 21:22 
GeneralPlease helpme i am in confuse Pin
muneer basha3-Feb-05 2:29
membermuneer basha3-Feb-05 2:29 
Questionerror ?? Pin
z_xf_w24-Jan-05 21:16
sussz_xf_w24-Jan-05 21:16 
AnswerRe: error ?? Pin
z_xf_w24-Jan-05 21:59
sussz_xf_w24-Jan-05 21:59 
GeneralRe: error ?? Pin
Douglas R. Keesler9-Jul-05 16:23
memberDouglas R. Keesler9-Jul-05 16:23 
Generallicensing Pin
Anonymous21-Oct-04 5:13
sussAnonymous21-Oct-04 5:13 
GeneralError in Disconnect funct. Pin
Brunko Victor19-Jul-04 15:24
memberBrunko Victor19-Jul-04 15:24 
GeneralRe: Error in Disconnect funct. Pin
Douglas R. Keesler9-Jul-05 16:07
memberDouglas R. Keesler9-Jul-05 16:07 
Generalsending concurrent emails Pin
DaberElay5-Jun-04 9:46
memberDaberElay5-Jun-04 9:46 
GeneralSending HTML mails Pin
12stephan3416-Apr-04 7:08
member12stephan3416-Apr-04 7:08 
GeneralRe: Sending HTML mails Pin
HughJampton17-Nov-04 6:12
memberHughJampton17-Nov-04 6:12 
GeneralRe: Sending HTML mails Pin
Douglas R. Keesler9-Jul-05 18:44
memberDouglas R. Keesler9-Jul-05 18:44 
GeneralUnresolved Externals Pin
ivax14-Apr-04 5:34
memberivax14-Apr-04 5:34 
GeneralRe: Unresolved Externals Pin
Lorenz Blum18-Apr-04 4:07
sussLorenz Blum18-Apr-04 4:07 
GeneralRe: Unresolved Externals Pin
flypoint24-Aug-05 17:10
sussflypoint24-Aug-05 17:10 
GeneralRe: Unresolved Externals - I GOT IT Pin
Lorenz Blum19-Apr-04 6:08
sussLorenz Blum19-Apr-04 6:08 
GeneralSocket handles leaks detected!! Pin
Igor V. Polyakoff15-Dec-03 7:37
memberIgor V. Polyakoff15-Dec-03 7:37 
Generalsupport username&password Pin
bowdom4-Nov-03 0:57
memberbowdom4-Nov-03 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160919.1 | Last Updated 5 Sep 2002
Article Copyright 2000 by Christopher W. Backen
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid