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

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

?? smtp.h

?? vc++網(wǎng)絡(luò)編程教程的源碼。可能對使用vc網(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地址進(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;                              //絕對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
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲午夜精品一区二区三区他趣| 亚洲18女电影在线观看| 欧美午夜在线一二页| 久久国产精品99久久久久久老狼| 中文字幕五月欧美| 日韩免费性生活视频播放| 91成人免费网站| 成人精品视频一区二区三区尤物| 日本亚洲视频在线| 亚洲精品成人a在线观看| 久久精品一区二区| 91精品国产乱码久久蜜臀| 99精品偷自拍| 丁香婷婷综合五月| 久久机这里只有精品| 亚洲国产精品久久艾草纯爱| 亚洲欧洲制服丝袜| 欧美国产日产图区| 久久奇米777| 日韩精品一区二区三区视频播放 | 亚洲国产wwwccc36天堂| 国产精品不卡在线观看| 精品国产乱码久久久久久久久| 欧美亚洲综合另类| 色综合色综合色综合| 国产成人亚洲综合a∨婷婷图片| 美腿丝袜亚洲三区| 奇米色一区二区三区四区| 亚洲成av人片| 亚洲国产综合91精品麻豆| 国产精品无遮挡| 国产日韩欧美在线一区| 精品久久人人做人人爰| 欧美mv和日韩mv国产网站| 欧美性感一类影片在线播放| 亚洲一区二区三区在线| 亚洲男人天堂一区| 欧美mv和日韩mv的网站| 在线免费亚洲电影| 国产一区中文字幕| 亚洲色图欧美在线| 久久一日本道色综合| 欧美日韩国产首页在线观看| 欧美96一区二区免费视频| 午夜精品福利在线| 欧美一区二区三区啪啪| 成人性生交大片免费看中文网站| 国产麻豆精品视频| 成人理论电影网| 91色在线porny| 色吧成人激情小说| 欧美日韩亚洲国产综合| 3751色影院一区二区三区| 欧美男女性生活在线直播观看| 欧美日韩一区高清| 日韩欧美一区在线| 国产婷婷色一区二区三区四区| 国产精品久久久久久户外露出| 国产日韩在线不卡| 中文字幕一区二区三| 亚洲精品视频在线观看免费| 亚洲国产成人tv| 狠狠色狠狠色综合| 成人免费视频视频在线观看免费 | 国产曰批免费观看久久久| 国产白丝网站精品污在线入口| 91女人视频在线观看| 色欧美乱欧美15图片| 日韩一区二区三区免费看 | 久久国产视频网| 日韩午夜激情视频| 久久综合久久综合久久| 一区免费观看视频| 亚洲一区二区黄色| 国内精品久久久久影院一蜜桃| 成人av中文字幕| 欧美精品三级在线观看| 国产情人综合久久777777| 一区二区三区免费| 九九**精品视频免费播放| 99re这里只有精品6| 欧美一区二区精品| 亚洲人精品午夜| 韩国一区二区三区| 91视频观看免费| 欧美色网一区二区| 欧美日韩国产美女| 亚洲一区在线视频| 久久精品国产999大香线蕉| 成人国产在线观看| 欧美日韩国产一二三| 国产精品久久久久婷婷| 奇米影视一区二区三区小说| 粉嫩一区二区三区性色av| 日本乱人伦aⅴ精品| 国产精品久久久久7777按摩| 久久99精品国产91久久来源| 婷婷中文字幕综合| 99久久久精品| 日韩一区有码在线| 日本不卡免费在线视频| 色www精品视频在线观看| 337p日本欧洲亚洲大胆精品| 亚洲国产精品久久久久婷婷884| 国产成人丝袜美腿| 91精品福利在线一区二区三区| 亚洲欧洲日韩在线| 国产精品资源在线看| 日韩视频在线观看一区二区| 亚洲一区二区三区自拍| www.视频一区| 久久免费电影网| 蜜臀91精品一区二区三区| 欧美性做爰猛烈叫床潮| 自拍偷拍欧美激情| 成人av资源网站| 国产人妖乱国产精品人妖| 黄色成人免费在线| 日韩欧美国产一区二区三区| 丝袜亚洲另类丝袜在线| 欧美特级限制片免费在线观看| 日韩美女视频一区二区 | 国产精品萝li| 国产91精品一区二区麻豆网站| 久久一区二区视频| 激情久久五月天| 欧美精品一区二区高清在线观看| 蓝色福利精品导航| 日韩一区二区三区av| 日韩1区2区3区| 日韩精品一区二区三区蜜臀| 免费视频最近日韩| 日韩精品一区二| 国模冰冰炮一区二区| 久久尤物电影视频在线观看| 裸体健美xxxx欧美裸体表演| 欧美一区三区四区| 另类综合日韩欧美亚洲| 精品国产免费人成电影在线观看四季| 日韩精品一二三| 日韩一级精品视频在线观看| 美腿丝袜亚洲色图| 2021国产精品久久精品| 国产成人免费xxxxxxxx| 国产精品污www在线观看| 成人免费高清在线观看| 亚洲三级在线观看| 在线精品视频小说1| 视频一区在线播放| 日韩欧美国产一区二区在线播放| 久草中文综合在线| 久久九九久久九九| 不卡一区中文字幕| 欧美男男青年gay1069videost| 成人激情av网| av中文字幕一区| 日韩一区二区三区精品视频| 色噜噜狠狠色综合中国| 国产成人免费在线| 国产一区二区不卡老阿姨| 久久成人麻豆午夜电影| 亚洲欧美视频在线观看视频| 日本一区免费视频| 精品免费视频一区二区| 日韩欧美中文字幕公布| 欧美麻豆精品久久久久久| 欧美mv和日韩mv国产网站| 天使萌一区二区三区免费观看| 欧美乱熟臀69xxxxxx| 韩国av一区二区| 日韩毛片精品高清免费| 4438成人网| 成人高清视频在线| 日本网站在线观看一区二区三区| 久久看人人爽人人| 色久优优欧美色久优优| 久久精品国内一区二区三区| 国产精品成人免费| 91精品国产一区二区| jiyouzz国产精品久久| 日韩成人午夜电影| 中文字幕免费观看一区| 欧美日韩国产成人在线免费| 国产盗摄视频一区二区三区| 一区二区三区中文字幕电影| 久久夜色精品国产欧美乱极品| 91在线porny国产在线看| 久久国产视频网| 亚洲国产精品久久不卡毛片 | 午夜在线成人av| 国产色综合久久| 欧美一区二区视频在线观看2022| 粗大黑人巨茎大战欧美成人| 蜜臀久久久久久久| 亚洲精品欧美专区| 欧美国产禁国产网站cc| 欧美成人精品高清在线播放| 在线看不卡av| 成人国产精品免费观看视频| 久久精品国产亚洲a|