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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? smtp.cpp

?? vc++網絡編程教程的源碼。可能對使用vc網絡編程的有用。
?? CPP
?? 第 1 頁 / 共 5 頁
字號:
              m_sFriendlyName(sFriendly), m_sEmailAddress(sAddress) 
{
  ASSERT(m_sEmailAddress.GetLength()); //An empty address is not allowed
}

CSMTPAddress& CSMTPAddress::operator=(const CSMTPAddress& r) 
{ 
  m_sFriendlyName = r.m_sFriendlyName; 
	m_sEmailAddress = r.m_sEmailAddress; 
	return *this;
}

CString CSMTPAddress::GetRegularFormat() const
{
  ASSERT(m_sEmailAddress.GetLength()); //Email Address must be valid

  CString sAddress;
  if (m_sFriendlyName.IsEmpty())
    sAddress = m_sEmailAddress;  //Just transfer the address across directly
  else
    sAddress.Format(_T("%s <%s>"), m_sFriendlyName, m_sEmailAddress);

  return sAddress;
}




CSMTPBodyPart::CSMTPBodyPart() : m_sCharset(_T("iso-8859-1")), m_sContentType(_T("text/plain")), m_pParentBodyPart(NULL), m_bQuotedPrintable(TRUE)
{
  //Automatically generate a unique boundary separator for this body part by creating a guid
  UUID uuid;
  UuidCreate(&uuid);
  
  //Convert it to a string
  #ifdef _UNICODE
  TCHAR* pszGuid = NULL;
  #else
  unsigned char* pszGuid = NULL;
  #endif
  UuidToString(&uuid, &pszGuid);

  m_sBoundary = pszGuid;

  //Free up the temp memory
  RpcStringFree(&pszGuid);
}

CSMTPBodyPart::CSMTPBodyPart(const CSMTPBodyPart& bodyPart)
{
  *this = bodyPart;
}

CSMTPBodyPart::~CSMTPBodyPart()
{
  //Free up the array memory
  for (int i=0; i<m_ChildBodyParts.GetSize(); i++)
    delete m_ChildBodyParts.GetAt(i);
  m_ChildBodyParts.RemoveAll();
}

CSMTPBodyPart& CSMTPBodyPart::operator=(const CSMTPBodyPart& bodyPart)
{
  m_sFilename        = bodyPart.m_sFilename;
  m_sText            = bodyPart.m_sText;       
  m_sTitle           = bodyPart.m_sTitle;      
  m_sContentType     = bodyPart.m_sContentType;
  m_sCharset         = bodyPart.m_sCharset;
  m_sContentBase     = bodyPart.m_sContentBase;
  m_sContentID       = bodyPart.m_sContentID;
  m_sContentLocation = bodyPart.m_sContentLocation;
  m_pParentBodyPart  = bodyPart.m_pParentBodyPart;
  m_sBoundary        = bodyPart.m_sBoundary;
  m_bQuotedPrintable = bodyPart.m_bQuotedPrintable;

  //Free up the array memory
  for (int i=0; i<m_ChildBodyParts.GetSize(); i++)
    delete m_ChildBodyParts.GetAt(i);
  m_ChildBodyParts.RemoveAll();
  //Now copy over the new object
  for (i=0; i<bodyPart.m_ChildBodyParts.GetSize(); i++)
  {
    CSMTPBodyPart* pBodyPart = new CSMTPBodyPart(*bodyPart.m_ChildBodyParts.GetAt(i));
    pBodyPart->m_pParentBodyPart  = this;
    m_ChildBodyParts.Add(pBodyPart);
  }

  return *this;
}

BOOL CSMTPBodyPart::SetFilename(const CString& sFilename)
{
  ASSERT(sFilename.GetLength());  //Empty Filename !

  //determine the file size
  CFileStatus fs;
  if (!CFile::GetStatus(sFilename, fs))
  {
    TRACE(_T("Failed to get the status for file %s, probably does not exist\n"), m_sFilename);
    return FALSE;
  }

	//Hive away the filename and form the title from the filename
  TCHAR sPath[_MAX_PATH];
  TCHAR sFname[_MAX_FNAME];
  TCHAR sExt[_MAX_EXT];
  _tsplitpath(sFilename, NULL, NULL, sFname, sExt);
  _tmakepath(sPath, NULL, NULL, sFname, sExt);
	m_sFilename = sFilename;
  m_sTitle = sPath;

  //Also sent the content type to be appropiate for an attachment
  m_sContentType = _T("application/octet-stream");

  return TRUE;
}

CString CSMTPBodyPart::Replace(const CString& sText, const CString& sToBeReplaced, const CString& sReplaceWith)
{
  //The string we will be returning
  CString sFind(sText);
  CString sReturn;

  int nFind = -1;
  int nToBeReplacedLength = sToBeReplaced.GetLength();
  do
  {
    nFind = sFind.Find(sToBeReplaced);
    if (nFind != -1)
    {
      sReturn += (sFind.Left(nFind) + sReplaceWith);
      sFind = sFind.Right(sFind.GetLength() - nFind - nToBeReplacedLength);
    }
  }
  while (nFind != -1);
  sReturn += sFind;

  return sReturn;
}

void CSMTPBodyPart::SetText(const CString& sText)
{
  m_sText = sText;

  //Ensure lines are correctly wrapped
  m_sText = Replace(m_sText, _T("\r\n"), _T("\n"));
  m_sText = Replace(m_sText, _T("\r"), _T("\n"));
  m_sText = Replace(m_sText, _T("\n"), _T("\r\n"));

  //Fix the case of a single dot on a line in the message body
  FixSingleDot(m_sText);

  //Also set the content type while we are at it
  m_sContentType = _T("text/plain");
}

void CSMTPBodyPart::SetContentID(const CString& sContentID) 
{
  m_sContentLocation.Empty();
  m_sContentID = sContentID; 
}

CString CSMTPBodyPart::GetContentID() const 
{ 
  return m_sContentID; 
}

void CSMTPBodyPart::SetContentLocation(const CString& sContentLocation) 
{ 
  m_sContentID.Empty();
  m_sContentLocation = sContentLocation; 
}

CString CSMTPBodyPart::GetContentLocation() const 
{ 
  return m_sContentLocation; 
}

char CSMTPBodyPart::HexDigit(int nDigit)
{
  if (nDigit < 10)
    return (char) (nDigit + '0');
  else
    return (char) (nDigit - 10 + 'A');
}

//Converts text to its Quoted printable equivalent according to RFC 2045
CString CSMTPBodyPart::QuotedPrintableEncode(const CString& sText)
{
  CString sTemp;
  int nSize = sText.GetLength();
  for (int i=0; i<nSize; i++)
  {
    BYTE c = (BYTE) sText[i];
    if (((c >= 33) && (c <= 60)) || ((c >= 62) && (c <= 126)) || (c == '\r') || (c == '\n') || (c == '\t') || (c == ' '))
      sTemp += TCHAR(c);
    else
    {
      //otherwise must quote the text
      sTemp += _T('=');
      sTemp += HexDigit((c & 0xF0) >> 4);
      sTemp += HexDigit(c & 0x0F);
    }
  }

  //Now insert soft line breaks where appropiate
  CString sOut;
  int nStartLine = 0;
  int nLen = sTemp.GetLength();
  for (i=0; i<nLen; i++)
  {
    BYTE c = (BYTE) sTemp[i];
    
    if (c == '\n' || c == '\r' || i == (nLen-1))
    {
      sOut += sTemp.Mid(nStartLine, i-nStartLine+1);
      nStartLine = i+1;
      continue;
    }

    if ((i - nStartLine) > SMTP_MAXLINE)
    {
      BOOL bInWord = TRUE;
      while (bInWord)
      {
        bInWord = (!isspace(c) && sTemp[i-2] != _T('='));
        if (bInWord)
        {
          --i;
          c = (BYTE) sTemp[i];
        }

		    if (i == nStartLine)
		    {
			    i = nStartLine + SMTP_MAXLINE;
			    break;
		    }
      }

      sOut += sTemp.Mid(nStartLine, i-nStartLine+1);
      sOut += _T("=\r\n");
      nStartLine = i+1;
    }
  }

  return sOut;
}

void CSMTPBodyPart::FreeHeader(LPSTR& pszHeader)
{
  //The CSMTPBodyPart class always allocates the memory for the header
  delete [] pszHeader;
  pszHeader = NULL;
}

void CSMTPBodyPart::FreeBody(LPSTR& pszBody)
{
  //The CSMTPBodyPart class allocates the memory for the body if it was not base 64 encoded
  if (pszBody)
  {
    delete [] pszBody;
    pszBody = NULL;
  }
}

void CSMTPBodyPart::FreeFooter(LPSTR& pszFooter)
{
  //The CSMTPBodyPart class always allocates the memory for the footer
  delete [] pszFooter;
  pszFooter = NULL;
}

BOOL CSMTPBodyPart::GetHeader(LPSTR& pszHeader, int& nHeaderSize)
{
  //For correct operation of the T2A macro, see MFC Tech Note 59
  USES_CONVERSION;

  //Assume the worst
  BOOL bSuccess = FALSE;
  CString sHeader;
  if (m_sFilename.GetLength())
  {
    //Ok, it's a file  

    //Form the header to go along with this body part
    if (GetNumberOfChildBodyParts())
		  sHeader.Format(_T("\r\n\r\n--%s\r\nContent-Type: %s; charset=%s; name=%s; Boundary=\"%s\"\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=%s\r\n"), 
                     m_pParentBodyPart->m_sBoundary, m_sContentType, m_sCharset, m_sTitle, m_sBoundary, m_sTitle);
    else
		  sHeader.Format(_T("\r\n\r\n--%s\r\nContent-Type: %s; charset=%s; name=%s\r\nContent-Transfer-Encoding: base64\r\nContent-Disposition: attachment; filename=%s\r\n"), 
                     m_pParentBodyPart->m_sBoundary, m_sContentType, m_sCharset, m_sTitle, m_sTitle);

    bSuccess = TRUE;
  }
  else
  {
    //ok, it's some text

    //Form the header to go along with this body part
    ASSERT(m_pParentBodyPart);
    if (GetNumberOfChildBodyParts())
    {
      if (m_bQuotedPrintable)
        sHeader.Format(_T("\r\n--%s\r\nContent-Type: %s; charset=%s; Boundary=\"%s\"\r\nContent-Transfer-Encoding: quoted-printable\r\n"),
                       m_pParentBodyPart->m_sBoundary, m_sContentType, m_sCharset, m_sBoundary);
      else
        sHeader.Format(_T("\r\n--%s\r\nContent-Type: %s; charset=%s; Boundary=\"%s\"\r\n"),
                       m_pParentBodyPart->m_sBoundary, m_sContentType, m_sCharset, m_sBoundary);
    }
    else
    {
      if (m_bQuotedPrintable)
        sHeader.Format(_T("\r\n--%s\r\nContent-Type: %s; charset=%s\r\nContent-Transfer-Encoding: quoted-printable\r\n"),
                       m_pParentBodyPart->m_sBoundary, m_sContentType, m_sCharset);
      else
        sHeader.Format(_T("\r\n--%s\r\nContent-Type: %s; charset=%s\r\n"),
                       m_pParentBodyPart->m_sBoundary, m_sContentType, m_sCharset);
    }

    bSuccess = TRUE;
  }

  //Add the other headers
  if (m_sContentBase.GetLength())
  {
    CString sLine;
    sLine.Format(_T("Content-Base: %s\r\n"), m_sContentBase);
    sHeader += sLine;
  }
  if (m_sContentID.GetLength())
  {
    CString sLine;
    sLine.Format(_T("Content-ID: %s\r\n"), m_sContentID);
    sHeader += sLine;
  }
  if (m_sContentLocation.GetLength())
  {
    CString sLine;
    sLine.Format(_T("Content-Location: %s\r\n"), m_sContentLocation);
    sHeader += sLine;
  }
  sHeader += _T("\r\n");

  nHeaderSize = _tcslen(sHeader);
  pszHeader = new char[nHeaderSize+1];
  strcpy(pszHeader, T2A((LPTSTR) (LPCTSTR) sHeader));

  return bSuccess;
}

BOOL CSMTPBodyPart::GetBody(LPSTR& pszBody, int& nBodySize)
{
	USES_CONVERSION;
	BOOL bSuccess = FALSE;

	if (m_sFilename.GetLength())
	{
		//如果是附件
		//打開文件
		CFile infile;
		if (infile.Open(m_sFilename, CFile::modeRead | CFile::shareDenyWrite))
		{
			DWORD dwSize = infile.GetLength();

			if (dwSize)
			{
				//讀入數據
				BYTE* pszIn = new BYTE[dwSize];
				try
				{
					infile.Read(pszIn, dwSize);
					bSuccess = TRUE;
				}
				catch(CFileException* pEx)
				{
					bSuccess = FALSE;
					pEx->Delete();
				}

				if (bSuccess)
				{
					//編碼
					m_Coder.Encode(pszIn, dwSize);

					//刪除了輸入緩沖區
					delete [] pszIn;

					//關閉輸入文件
					infile.Close();

					//形成編碼后的發送內容
					LPSTR pszEncoded = m_Coder.EncodedMessage();
					int nEncodedSize = m_Coder.EncodedMessageSize();
					nBodySize = nEncodedSize + (((nEncodedSize/76)+1)*2) + 1;
					pszBody = new char[nBodySize];
					--nBodySize; 

					int nInPos = 0;
					int nOutPos = 0;
					while (nInPos < nEncodedSize)
					{
						int nThisLineSize = min(nEncodedSize - nInPos, SMTP_MAXLINE);
						CopyMemory(&pszBody[nOutPos], &pszEncoded[nInPos], nThisLineSize);
						nOutPos += nThisLineSize;
						CopyMemory(&pszBody[nOutPos], "\r\n", 2);
						nOutPos += 2;
						nInPos += nThisLineSize;
					}
					pszBody[nOutPos] = '\0'; //以空字符串結束
				}
			}
			else
			{

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人avav在线| 九色|91porny| 色哟哟一区二区在线观看| 国产精品国产a级| 成人午夜视频在线| 国产精品色婷婷| 91在线视频在线| 亚洲精品精品亚洲| 欧美成人a视频| 全部av―极品视觉盛宴亚洲| 日韩精品资源二区在线| 激情五月婷婷综合网| 久久人人97超碰com| 粉嫩一区二区三区在线看| 国产精品高潮呻吟| 欧美日韩不卡在线| 久久精品国产亚洲aⅴ| 久久免费视频一区| 99久久99久久精品免费观看| 亚洲不卡av一区二区三区| 欧美成人女星排名| 成人99免费视频| 亚洲电影中文字幕在线观看| 精品美女在线播放| 色婷婷久久综合| 日欧美一区二区| 国产拍揄自揄精品视频麻豆| 91蝌蚪porny| 日本一区中文字幕| 日本一区二区电影| 3d动漫精品啪啪| 国产精品77777竹菊影视小说| 一区二区三区四区亚洲| 日韩欧美视频一区| 色婷婷综合中文久久一本| 午夜精品免费在线| 久久精品视频免费观看| 欧美美女一区二区在线观看| 国产成人夜色高潮福利影视| 亚洲与欧洲av电影| 国产欧美日本一区视频| 欧美高清一级片在线| av午夜一区麻豆| 激情综合五月婷婷| 有码一区二区三区| 久久久精品2019中文字幕之3| 欧美绝品在线观看成人午夜影视| 成人一区在线看| 日韩高清不卡一区二区三区| 国产精品网站一区| 欧美一区二区视频网站| 色综合天天综合色综合av| 极品尤物av久久免费看| 亚洲观看高清完整版在线观看| 久久婷婷国产综合精品青草| 欧美日韩成人综合在线一区二区 | 国产农村妇女毛片精品久久麻豆 | 欧美日韩国产一级片| 成人夜色视频网站在线观看| 久久se精品一区二区| 午夜影院久久久| 自拍偷自拍亚洲精品播放| 久久综合九色综合97婷婷| 7777精品伊人久久久大香线蕉经典版下载 | 欧美体内she精高潮| gogogo免费视频观看亚洲一| 国产伦理精品不卡| 激情综合色综合久久| 日本aⅴ精品一区二区三区| 一区二区免费看| ...xxx性欧美| 国产精品二三区| 中文字幕在线一区免费| 久久久久88色偷偷免费| 久久久久久久久久看片| 久久嫩草精品久久久精品| 精品日韩99亚洲| www国产精品av| 26uuu精品一区二区在线观看| 欧美一区二区国产| 日韩色在线观看| 日韩免费观看高清完整版在线观看| 欧美日本在线视频| 日韩一区二区电影| 日韩精品中午字幕| 久久精品亚洲一区二区三区浴池| 久久综合色婷婷| 久久久久久久久久电影| 久久久99免费| 国产精品久久久久久久浪潮网站| 亚洲日本在线a| 亚洲午夜精品久久久久久久久| 一区二区欧美精品| 偷拍一区二区三区四区| 美女网站在线免费欧美精品| 韩国理伦片一区二区三区在线播放| 韩国女主播一区| www.99精品| 欧美影视一区在线| 91精品国产福利| 久久久久久久久久美女| 中文字幕一区二区三区在线观看 | 一区二区三区**美女毛片| 亚洲国产另类精品专区| 老司机免费视频一区二区| 精品一二三四区| 成人免费电影视频| 在线观看免费一区| 精品久久久久久无| 国产精品久久久久久久蜜臀| 亚洲自拍另类综合| 久久疯狂做爰流白浆xx| av中文字幕在线不卡| 欧美嫩在线观看| 久久先锋资源网| 一区二区三区波多野结衣在线观看| 日本系列欧美系列| 成人免费视频视频在线观看免费| 欧美在线影院一区二区| 精品入口麻豆88视频| 亚洲色图视频免费播放| 日本aⅴ免费视频一区二区三区 | 精品国产百合女同互慰| 亚洲欧美在线高清| 美女视频一区二区| 91一区在线观看| 日韩一区日韩二区| 青青草97国产精品免费观看| 99在线精品观看| 欧美一级片免费看| 综合在线观看色| 久久99国产精品久久| 在线免费观看日本欧美| 国产亚洲综合性久久久影院| 亚洲不卡一区二区三区| 91亚洲资源网| 精品女同一区二区| 亚洲一级二级在线| 成人avav影音| 久久女同性恋中文字幕| 日本最新不卡在线| 日本高清无吗v一区| 国产欧美精品国产国产专区| 水野朝阳av一区二区三区| 91久久久免费一区二区| 国产精品色哟哟| 国产乱码字幕精品高清av | 亚洲免费观看高清完整版在线观看| 蜜臀久久久99精品久久久久久| 色综合久久综合中文综合网| 国产三级三级三级精品8ⅰ区| 午夜亚洲福利老司机| 91亚洲国产成人精品一区二区三 | 自拍偷拍亚洲综合| 国产一区二区美女诱惑| 日韩亚洲欧美在线观看| 午夜精品久久久久久久久久| 一本色道a无线码一区v| 亚洲三级免费观看| 大陆成人av片| 国产欧美一区二区三区鸳鸯浴| 麻豆精品视频在线观看视频| 欧美麻豆精品久久久久久| 亚洲一区中文在线| 91麻豆高清视频| 亚洲裸体xxx| 91小宝寻花一区二区三区| 亚洲欧洲国产专区| 91香蕉视频黄| 亚洲综合男人的天堂| 91国在线观看| 亚洲一二三四区| 欧美日韩一区二区在线观看视频| 亚洲精品成人在线| 91成人免费在线视频| 亚洲成人av福利| 欧美一级夜夜爽| 欧美精品国产精品| 亚洲444eee在线观看| 欧美高清视频不卡网| 亚洲最大色网站| 99精品一区二区三区| 亚洲人成7777| 欧美丝袜丝nylons| 亚洲丶国产丶欧美一区二区三区| 欧美美女网站色| 久久99精品久久久久久久久久久久| 欧美一级视频精品观看| 国产麻豆视频一区| 国产精品国产三级国产a| 色偷偷久久人人79超碰人人澡| 一区二区三区四区av| 欧美丰满美乳xxx高潮www| 久久精品99久久久| 中文字幕av一区 二区| 99久久久久免费精品国产| 午夜精品久久久久久久| 精品盗摄一区二区三区| 波多野结衣中文字幕一区 | 91精品国产综合久久久久久漫画 |