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

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

?? smtp.h

?? 網(wǎng)絡(luò)編程實例
?? H
字號:
/*
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地址類,用于對EMAIL地址進行各種處理
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;                              //絕對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;


//該類用來保存服務器返回的消息
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的主類,用于進行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__

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲va韩国va欧美va精品| 欧美色网一区二区| 欧美不卡在线视频| 奇米精品一区二区三区四区| 884aa四虎影成人精品一区| 日韩电影一区二区三区| 日韩欧美国产一区二区三区 | 欧美亚男人的天堂| 亚洲地区一二三色| 精品国精品自拍自在线| 国产精品1区2区3区在线观看| 国产精品乱人伦中文| 91在线一区二区三区| 亚洲电影视频在线| 精品人伦一区二区色婷婷| 岛国一区二区在线观看| 综合网在线视频| 欧美剧情电影在线观看完整版免费励志电影| 天使萌一区二区三区免费观看| 精品剧情v国产在线观看在线| 国产性做久久久久久| 亚洲色图都市小说| 91麻豆成人久久精品二区三区| 亚洲黄色av一区| 3d动漫精品啪啪1区2区免费| 国产资源精品在线观看| 国产精品毛片高清在线完整版| 欧美色手机在线观看| 蜜臀国产一区二区三区在线播放 | 欧美极品xxx| 欧美日韩一区二区三区在线看 | 国产一区二区三区四| 综合中文字幕亚洲| 日韩精品在线网站| 一本到一区二区三区| 激情综合色播激情啊| 亚洲精品成人精品456| 久久亚洲春色中文字幕久久久| 亚洲国产精品久久艾草纯爱| 一本久久精品一区二区| 麻豆免费精品视频| 日韩美女视频19| 精品国产乱码久久久久久浪潮| 色综合中文字幕国产| 日韩在线a电影| 亚洲精品乱码久久久久久久久| 欧美一区二区免费| 欧美亚洲国产bt| 成人av电影在线观看| 久久成人羞羞网站| 午夜精品在线看| 1024亚洲合集| 久久久国际精品| 日韩亚洲电影在线| 欧美美女一区二区在线观看| k8久久久一区二区三区| 激情国产一区二区| 天天操天天干天天综合网| 中文字幕亚洲电影| 国产午夜精品一区二区三区视频 | 日韩免费一区二区| 欧美性一级生活| 91美女在线观看| 不卡一区二区在线| 国产一区二区三区av电影| 日本欧美一区二区三区乱码| 亚洲成人午夜影院| 亚洲第一会所有码转帖| 亚洲精品网站在线观看| 国产精品高潮呻吟| 中文字幕亚洲在| 中文字幕一区二区三区蜜月| 国产精品私人影院| 中文字幕av在线一区二区三区| 久久女同互慰一区二区三区| 日韩视频免费直播| 日韩欧美视频一区| 日韩一区二区视频| 日韩欧美卡一卡二| 日韩一区二区免费在线观看| 欧美一区二区三区在线观看| 欧美疯狂做受xxxx富婆| 777久久久精品| 91麻豆精品91久久久久同性| 91精品国产综合久久久久久漫画 | 亚洲国产视频一区| 亚洲一区二区综合| 五月激情丁香一区二区三区| 午夜日韩在线观看| 日韩电影在线免费看| 久久疯狂做爰流白浆xx| 国产精品自拍av| 99精品久久只有精品| 在线免费观看视频一区| 69堂成人精品免费视频| 91精品婷婷国产综合久久竹菊| 日韩免费观看高清完整版| 成人av网站大全| 一本一道波多野结衣一区二区| 欧美在线视频全部完| 91精品国产综合久久久久| 精品毛片乱码1区2区3区| 久久久一区二区三区| 17c精品麻豆一区二区免费| 亚洲精品成a人| 免费观看一级欧美片| 国产乱色国产精品免费视频| 不卡免费追剧大全电视剧网站| 欧洲生活片亚洲生活在线观看| 欧美一区二区三区视频在线观看| 精品日韩一区二区| 亚洲欧美日韩国产一区二区三区| 亚洲成a人在线观看| 久久99精品国产麻豆婷婷洗澡| 成人av在线网| 欧美一级免费大片| 国产精品久久免费看| 夜夜嗨av一区二区三区四季av| 男男视频亚洲欧美| 成人视屏免费看| 91精品婷婷国产综合久久| 国产精品久久久久aaaa| 日韩在线播放一区二区| 99久久久精品| 精品理论电影在线观看| 一区二区欧美视频| 国产精品一品二品| 7799精品视频| 亚洲欧美视频在线观看| 国产在线麻豆精品观看| 欧美影视一区在线| 成人夜色视频网站在线观看| 国产精品一区二区三区乱码 | 亚洲mv在线观看| 丁香另类激情小说| 欧美一二三区在线| 亚洲一区免费观看| 高潮精品一区videoshd| 日韩一二三四区| 亚洲一区在线观看视频| 不卡的电视剧免费网站有什么| 欧美美女bb生活片| 亚洲精品一二三区| 成人高清视频在线观看| 久久在线观看免费| 日本欧美一区二区三区乱码 | 国产精品毛片久久久久久| 午夜日韩在线电影| 欧洲精品一区二区| 中文字幕高清不卡| 国产在线播放一区| 777久久久精品| 午夜视频在线观看一区二区三区| av一区二区不卡| 国产性色一区二区| 国产综合色产在线精品| 欧美成人三级电影在线| 午夜影视日本亚洲欧洲精品| 在线观看一区不卡| 亚洲另类在线一区| 99在线视频精品| 国产人成一区二区三区影院| 久久成人免费电影| 欧美一级电影网站| 久久国产麻豆精品| 精品久久久久香蕉网| 视频一区中文字幕国产| 欧美一区二区人人喊爽| 日韩福利电影在线观看| 91麻豆精品国产自产在线 | 久久精品国产精品亚洲精品 | 欧美激情一区二区三区在线| 国产乱理伦片在线观看夜一区| 精品欧美一区二区在线观看| 免费在线观看精品| 日韩一区二区三区电影| 久久国产综合精品| 国产亚洲精品福利| caoporm超碰国产精品| 亚洲日韩欧美一区二区在线| 色综合天天性综合| 亚洲一二三区在线观看| 欧美色中文字幕| 美国十次了思思久久精品导航| 日韩精品中文字幕一区二区三区| 精品制服美女久久| 久久久久久综合| 99热精品一区二区| 亚洲电影视频在线| 精品国产一区二区国模嫣然| 国产精品一区二区视频| 综合网在线视频| 欧美人动与zoxxxx乱| 久久精品国产成人一区二区三区| 精品剧情v国产在线观看在线| 成人精品电影在线观看| 亚洲一区二区三区中文字幕| 日韩一级成人av| 不卡视频免费播放| 奇米在线7777在线精品|