亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? smtp.h

?? VC++網(wǎng)絡(luò)通信編程實(shí)例案例精選》源代碼 第三部分
?? H
字號(hào):
/*
Module : SMTP.H
Purpose: Defines the interface for a MFC class encapsulation of the SMTP protocol
Created: PJN / 22-05-1998

Copyright (c) 1998 - 2002 by PJ Naughter.  (Web: www.naughter.com, Email: pjna@naughter.com)

All rights reserved.

Copyright / Usage Details:

You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) 
when your product is released in binary form. You are allowed to modify the source code in any way you want 
except you cannot modify the copyright details at the top of each module. If you want to distribute source 
code with your application, then you are only allowed to distribute versions released by the author. This is 
to maintain a single distribution point for the source code. 

*/


/////////////////////////////// Defines ///////////////////////////////////////

#ifndef __SMTP_H__
#define __SMTP_H__

#ifndef __AFXTEMPL_H__
#pragma message("To avoid this message, put afxtempl.h in your PCH")
#include <afxtempl.h>
#endif

#ifndef _WINSOCKAPI_
#pragma message("To avoid this message, put afxsock.h or winsock.h in your PCH")
#include <winsock.h>
#endif

#ifndef __AFXPRIV_H__
#pragma message("To avoid this message, put afxpriv.h in your PCH")
#include <afxpriv.h>
#endif

#include "Base64Coder.h"

 

/////////////////////////////// Classes ///////////////////////////////////////

//Simple Socket wrapper class
class CSMTPSocket
{
public:
//Constructors / Destructors
  CSMTPSocket();
  ~CSMTPSocket();

//methods
  BOOL  Create();
  BOOL  Connect(LPCTSTR pszHostAddress, int nPort, LPCTSTR pszLocalBoundAddress);
  BOOL  Send(LPCSTR pszBuf, int nBuf);
  void  Close();
  int   Receive(LPSTR pszBuf, int nBuf);
  BOOL  IsReadable(BOOL& bReadible);

protected:
  BOOL   Connect(const SOCKADDR* lpSockAddr, int nSockAddrLen);
  SOCKET m_hSocket;
};

                     
//SMTP地址類,用于對(duì)EMAIL地址進(jìn)行各種處理
class CSMTPAddress
{
public: 
  CSMTPAddress();
  CSMTPAddress(const CSMTPAddress& address);
	CSMTPAddress(const CString& sAddress);
	CSMTPAddress(const CString& sFriendly, const CString& sAddress);
	CSMTPAddress& operator=(const CSMTPAddress& r);

//方法
  CString GetRegularFormat() const;

//數(shù)據(jù)成員
	CString m_sFriendlyName; //保存名稱
	CString m_sEmailAddress; //保存EMAIL地址
};


//該類處理信件內(nèi)容
class CSMTPBodyPart
{
public:
  CSMTPBodyPart();
  CSMTPBodyPart(const CSMTPBodyPart& bodyPart);
  CSMTPBodyPart& operator=(const CSMTPBodyPart& bodyPart);
  virtual ~CSMTPBodyPart();

//Accessors / Mutators
  BOOL    SetFilename(const CString& sFilename);
  CString GetFilename() const { return m_sFilename; }; 

  void    SetText(const CString& sText);
  CString GetText() const { return m_sText; };

	void    SetTitle(const CString& sTitle) { m_sTitle = sTitle; };
	CString GetTitle() const { return m_sTitle; };

	void    SetContentType(const CString& sContentType) { m_sContentType = sContentType; };
	CString GetContentType() const { return m_sContentType; };

	void    SetCharset(const CString& sCharset) { m_sCharset = sCharset; };
	CString GetCharset() const { return m_sCharset; };

  void    SetContentBase(const CString& sContentBase) { m_sContentBase = sContentBase; };
  CString GetContentBase() const { return m_sContentBase; };

  void    SetContentID(const CString& sContentID);
  CString GetContentID() const;

  void    SetContentLocation(const CString& sContentLocation);
  CString GetContentLocation() const;

  CString GetBoundary() const { return m_sBoundary; };

//Misc methods
  BOOL GetHeader(LPSTR& pszHeader, int& nHeaderSize);
  BOOL GetBody(LPSTR& pszBody, int& nBodySize);
  BOOL GetFooter(LPSTR& pszFooter, int& nFooterSize);
  void FreeHeader(LPSTR& pszHeader);
  void FreeBody(LPSTR& pszBody);
  void FreeFooter(LPSTR& pszFooter);
  CSMTPBodyPart* FindFirstBodyPart(const CString sContentType);
  void SetQuotedPrintable(BOOL bValue) { m_bQuotedPrintable = bValue; };
  BOOL GetQuotedPrintable() const { return m_bQuotedPrintable; };

//子信體函數(shù)
	int            GetNumberOfChildBodyParts() const;
	int            AddChildBodyPart(CSMTPBodyPart& bodyPart);
	void           RemoveChildBodyPart(int nIndex);
	CSMTPBodyPart* GetChildBodyPart(int nIndex);
  CSMTPBodyPart* GetParentBodyPart();

//靜態(tài)函數(shù)
  static CString QuotedPrintableEncode(const CString& sText);
  static char HexDigit(int nDigit);

protected:
//成員函數(shù)
  CString      m_sFilename;                                 //附件名稱
  CString      m_sTitle;                                    //呵呵,信件名稱What is it to be know as when emailed
  CString      m_sContentType;                              //信件內(nèi)容類型
  CString      m_sCharset;                                  //新建內(nèi)容的字符集
  CString      m_sContentBase;                              //絕對(duì)URL路徑
  CString      m_sContentID;                                //The uniqiue ID for this body part (allows other body parts to refer to us via a CID URL)
  CString      m_sContentLocation;                          //The relative URL for this body part (allows other body parts to refer to us via a relative URL)
  CString      m_sText;                                     //If using strings rather than file, then this is it!
  CBase64Coder m_Coder;	                                    //Base64 encoder / decoder instance for this body part
  CArray<CSMTPBodyPart*, CSMTPBodyPart*&> m_ChildBodyParts; //Child body parts for this body part
  CSMTPBodyPart* m_pParentBodyPart;                         //The parent body part for this body part
  CString      m_sBoundary;                                 //String which is used as the body separator for all child mime parts
  BOOL         m_bQuotedPrintable;                          //Should the body text by quoted printable encoded

//方法
  void FixSingleDot(CString& sBody);
  CString Replace(const CString& sText, const CString& sToBeReplaced, const CString& sReplaceWith);

  friend class CSMTPMessage;
  friend class CSMTPConnection;
};


////////////////// typedefs 
typedef CArray<CSMTPAddress, CSMTPAddress&> CSMTPAddressArray;


////////////////// Forward declaration
class CSMTPConnection;


//該類用來保存服務(wù)器返回的消息
class CSMTPMessage
{
public:
//Enums
	enum RECIPIENT_TYPE { TO, CC, BCC };

//Constructors / Destructors
  CSMTPMessage();
  virtual ~CSMTPMessage();

//接收相關(guān)函數(shù)
	int           GetNumberOfRecipients(RECIPIENT_TYPE RecipientType = TO) const;
	int           AddRecipient(CSMTPAddress& recipient, RECIPIENT_TYPE RecipientType = TO);
	void          RemoveRecipient(int nIndex, RECIPIENT_TYPE RecipientType = TO);
	CSMTPAddress* GetRecipient(int nIndex, RECIPIENT_TYPE RecipientType = TO);
  BOOL          AddMultipleRecipients(const CString& sRecipients, RECIPIENT_TYPE RecipientType);
  static CSMTPAddressArray* ParseMultipleRecipients(const CString& sRecipients);

//信體處理函數(shù)
  int            GetNumberOfBodyParts() const;
	int            AddBodyPart(CSMTPBodyPart& bodyPart);
	void           RemoveBodyPart(int nIndex);
	CSMTPBodyPart* GetBodyPart(int nIndex);
  int            AddMultipleAttachments(const CString& sAttachments);

//其他方法
  virtual CString GetHeader();
  void            AddTextBody(const CString& sBody);
  CString         GetTextBody();
  void            AddHTMLBody(const CString& sBody, const CString& sContentBase);
  CString         GetHTMLBody();
  void            AddCustomHeader(const CString& sHeader);
  CString         GetCustomHeader(int nIndex);
  int             GetNumberOfCustomHeaders() const;
  void            RemoveCustomHeader(int nIndex);
  void            SetCharset(const CString& sCharset);
  CString         GetCharset() const;
  void            SetMime(BOOL bMime);
  BOOL            GetMime() const { return m_bMime; };
  BOOL            SaveToDisk(const CString& sFilename);
                          
//數(shù)據(jù)成員
	CSMTPAddress  m_From;
	CString       m_sSubject;
  CString       m_sXMailer;
	CSMTPAddress  m_ReplyTo;
  CSMTPBodyPart m_RootPart;


protected:
  BOOL WriteToDisk(CFile& file, CSMTPBodyPart* pBodyPart, BOOL bRoot);
  CString HeaderEncode(const CString& sText) const;
  CString ConvertHTMLToPlainText(const CString& sHtml);

	CArray<CSMTPAddress*, CSMTPAddress*&> m_ToRecipients;
	CArray<CSMTPAddress*, CSMTPAddress*&> m_CCRecipients;
	CArray<CSMTPAddress*, CSMTPAddress*&> m_BCCRecipients;
  CStringArray                          m_CustomHeaders;
  BOOL                                  m_bMime;

  friend class CSMTPConnection;
};



//SMTP的主類,用于進(jìn)行SMTP的連接
class CSMTPConnection
{
public:

//typedefs
enum LoginMethod
{
  NoLoginMethod=0,
  CramMD5Method=1,
  AuthLoginMethod=2,
  LoginPlainMethod=3
};

  CSMTPConnection();
  virtual ~CSMTPConnection();

//方法
  BOOL    Connect(LPCTSTR pszHostName, LoginMethod lm=NoLoginMethod, LPCTSTR pszUsername=NULL, LPCTSTR pszPassword=NULL, int nPort=25, LPCTSTR pszLocalBoundAddress=NULL);
  BOOL    Disconnect();
  CString GetLastCommandResponse() const { return m_sLastCommandResponse; };
  int     GetLastCommandResponseCode() const { return m_nLastCommandResponseCode; };
  DWORD   GetTimeout() const { return m_dwTimeout; };
  void    SetTimeout(DWORD dwTimeout) { m_dwTimeout = dwTimeout; };
	BOOL    SendMessage(CSMTPMessage& Message);
  BOOL    SendMessage(const CString& sMessageOnFile, CSMTPAddressArray& Recipients, const CSMTPAddress& From, DWORD dwSendBufferSize = 4096);
  BOOL    SendMessage(BYTE* pMessage, DWORD dwMessageSize, CSMTPAddressArray& Recipients, const CSMTPAddress& From, DWORD dwSendBufferSize = 4096);
  void    SetHeloHostname(const CString& sHostname) { m_sHeloHostname = sHostname; };
  CString GetHeloHostName() const { return m_sHeloHostname; };

//靜態(tài)方法
  static BOOL ConnectToInternet();
  static BOOL CloseInternetConnection();

//虛擬方法
  virtual BOOL OnSendProgress(DWORD dwCurrentBytes, DWORD dwTotalBytes);

protected:
#ifndef CSMTP_NORSA
  void MD5Digest(unsigned char*text, int text_len, unsigned char*key, int key_len, unsigned char* digest);
#endif
  BOOL ConnectESMTP(LPCTSTR pszLocalName, LPCTSTR pszUsername, LPCTSTR pszPassword, LoginMethod lm);
  BOOL ConnectSMTP(LPCTSTR pszLocalName);
#ifndef CSMTP_NORSA
	BOOL CramLogin(LPCTSTR pszUsername, LPCTSTR pszPassword);
#endif
	BOOL  AuthLogin(LPCTSTR pszUsername, LPCTSTR pszPassword);
	BOOL  AuthLoginPlain(LPCTSTR pszUsername, LPCTSTR pszPassword);
	BOOL  SendRCPTForRecipient(CSMTPAddress& recipient);
  BOOL  SendBodyPart(CSMTPBodyPart* pBodyPart, BOOL bRoot);
	virtual BOOL ReadCommandResponse(int nExpectedCode);
	virtual BOOL ReadResponse(LPSTR pszBuffer, int nInitialBufSize, LPSTR pszTerminator, 
                            int nExpectedCode, LPSTR* ppszOverFlowBuffer, int nGrowBy=4096);

  CSMTPSocket m_SMTP;
  BOOL        m_bConnected;
  CString     m_sLastCommandResponse;
  CString     m_sHeloHostname;
	DWORD       m_dwTimeout;
  int         m_nLastCommandResponseCode;
};

#endif //__SMTP_H__

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美人牲a欧美精品| 日韩亚洲欧美中文三级| 久久精品免费看| 国产精品免费av| 日韩一区二区不卡| 91网站视频在线观看| 国内成人自拍视频| 亚洲国产一区二区视频| 国产精品久久午夜| 欧美成人aa大片| 欧美日韩一级大片网址| 成人网在线免费视频| 美女网站一区二区| 丝袜亚洲另类欧美| 一区二区三区四区高清精品免费观看| 久久久午夜精品| 欧美绝品在线观看成人午夜影视| 99综合影院在线| 成人晚上爱看视频| 国产九色sp调教91| 麻豆精品久久久| 蜜臀av性久久久久蜜臀aⅴ| 亚洲成人av电影| 亚洲一区二区av在线| 亚洲男同性恋视频| 一色桃子久久精品亚洲| 国产女人18毛片水真多成人如厕| 精品国产精品网麻豆系列| 日韩亚洲欧美一区| 91精品国产一区二区三区蜜臀| 欧美日韩精品三区| 欧美日韩亚洲综合一区二区三区| 一本色道久久综合狠狠躁的推荐| kk眼镜猥琐国模调教系列一区二区 | 一区二区三区在线视频免费观看| 亚洲国产精品成人久久综合一区| 国产日产欧美一区| 国产欧美日产一区| 国产精品二区一区二区aⅴ污介绍| 国产欧美精品一区二区色综合 | 99精品欧美一区二区蜜桃免费 | 精久久久久久久久久久| 欧美aⅴ一区二区三区视频| 日韩精品国产欧美| 日本最新不卡在线| 另类中文字幕网| 国产综合久久久久影院| 国产精品一区二区果冻传媒| 国产jizzjizz一区二区| www.欧美日韩国产在线| 色综合色综合色综合| 色呦呦日韩精品| 欧美日韩久久不卡| 日韩一区二区免费高清| 精品欧美一区二区在线观看| 久久久久久99久久久精品网站| 日本一区二区高清| 亚洲欧美日韩在线| 婷婷国产v国产偷v亚洲高清| 久久97超碰国产精品超碰| 国产一区二区三区不卡在线观看 | 亚洲精品少妇30p| 亚洲成人av福利| 久久电影国产免费久久电影| 国产精品99精品久久免费| hitomi一区二区三区精品| 91小视频在线免费看| 欧美久久一二三四区| 久久一二三国产| 亚洲欧美成人一区二区三区| 五月激情综合色| 国产精品中文有码| 日本精品一区二区三区高清| 91精选在线观看| 国产亚洲精品超碰| 亚洲一区二区偷拍精品| 精品在线免费视频| 色婷婷久久久亚洲一区二区三区| 欧美精品九九99久久| 国产校园另类小说区| 亚洲午夜久久久久久久久电影网 | 麻豆精品视频在线观看视频| av一区二区三区四区| 欧美日韩精品久久久| 国产三级欧美三级日产三级99 | 中文字幕欧美三区| 香蕉成人伊视频在线观看| 国产精品自拍av| 欧美日韩一区视频| 国产精品视频一二三区 | 午夜精品一区二区三区电影天堂 | 欧美日韩一二三区| 中文字幕免费不卡| 人人狠狠综合久久亚洲| 91一区二区三区在线观看| 欧美一区二区三区精品| 亚洲免费色视频| 国产毛片精品视频| 在线播放日韩导航| 亚洲人吸女人奶水| 国产成人精品免费网站| 欧美一区二区三区在线视频| 亚洲男同性恋视频| 成人免费av在线| 欧美成人一区二区三区片免费| 一区二区高清视频在线观看| 成人午夜精品在线| 亚洲精品一区二区精华| 日韩av中文字幕一区二区三区| 一本色道亚洲精品aⅴ| 国产日韩一级二级三级| 精品在线观看视频| 欧美一区二区成人6969| 亚洲一二三四在线观看| 色一区在线观看| 中文字幕一区二区三区不卡在线| 精品一区在线看| 欧美一区二区三区四区视频| 午夜精品福利视频网站| 欧洲一区在线电影| 亚洲精品写真福利| 91美女片黄在线观看| 自拍偷自拍亚洲精品播放| 成人综合激情网| 中文字幕欧美国产| 国产91在线看| 欧美国产日韩a欧美在线观看| 国产九九视频一区二区三区| 久久久美女艺术照精彩视频福利播放| 六月丁香婷婷色狠狠久久| 91精品国产一区二区| 日本欧美一区二区在线观看| 欧美放荡的少妇| 美女视频一区二区| 精品少妇一区二区三区视频免付费 | 欧美中文字幕亚洲一区二区va在线| 国产精品动漫网站| 99久久免费精品| 亚洲日本va午夜在线影院| 99久久久精品| 亚洲狠狠丁香婷婷综合久久久| 色欧美乱欧美15图片| 一区二区在线看| 欧美日韩久久不卡| 免费高清不卡av| 欧美mv日韩mv| 成人午夜伦理影院| 亚洲精品中文在线影院| 欧美亚洲国产一区二区三区| 亚洲成av人综合在线观看| 欧美一卡二卡三卡四卡| 韩国午夜理伦三级不卡影院| 欧美激情综合五月色丁香小说| 777亚洲妇女| 激情另类小说区图片区视频区| 久久久精品免费免费| www.欧美日韩| 亚洲五月六月丁香激情| 91精品久久久久久蜜臀| 国产一区三区三区| 亚洲三级在线看| 91麻豆精品国产91久久久更新时间| 久久精品国产77777蜜臀| 国产视频911| 欧美三区免费完整视频在线观看| 美腿丝袜亚洲一区| 国产精品久久久久久亚洲伦| 欧美无砖专区一中文字| 久久国产剧场电影| 成人欧美一区二区三区视频网页| 欧美视频中文字幕| 国产乱子伦视频一区二区三区 | 欧美群妇大交群的观看方式| 老司机精品视频线观看86| 日本一区免费视频| 欧美亚洲日本国产| 国产伦精品一区二区三区在线观看 | 91精品国产品国语在线不卡| 国产夫妻精品视频| 亚洲网友自拍偷拍| 国产亚洲一二三区| 欧美日韩美女一区二区| 国产精品123| 天堂影院一区二区| 国产精品女上位| 91精品国产91久久久久久一区二区| 国产 日韩 欧美大片| 午夜成人免费视频| 国产精品免费观看视频| 欧美一区二区三级| 一本久久a久久精品亚洲| 久久99九九99精品| 亚洲午夜在线视频| 国产精品丝袜黑色高跟| 日韩欧美高清在线| 在线看国产一区| 成人免费毛片aaaaa**| 日本 国产 欧美色综合| 亚洲综合一区二区三区| 国产精品国产馆在线真实露脸 |