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

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

?? smtp.cpp

?? 網絡編程實例
?? 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一区二区三区免费野_久草精品视频
久久精品男人天堂av| 成人激情黄色小说| 亚洲国产精品一区二区久久 | 在线亚洲高清视频| 国产精品1区二区.| 成人av在线网| 色噜噜久久综合| 欧美蜜桃一区二区三区| 精品写真视频在线观看| 亚洲国产视频一区二区| 久久婷婷一区二区三区| 日韩你懂的在线观看| 国产精品女人毛片| 成人午夜精品在线| 中文字幕中文字幕中文字幕亚洲无线| 中文字幕一区二区三区在线播放| 97久久精品人人做人人爽| 亚洲精品ww久久久久久p站| 欧美日韩一卡二卡| 精品一区二区日韩| 亚洲靠逼com| 日韩精品最新网址| 成人av动漫网站| 日韩和欧美的一区| 国产成人免费在线观看不卡| 在线日韩一区二区| 欧美电影免费观看完整版| 国产精品国产自产拍高清av王其 | 久久精品国产精品青草| 国产成a人无v码亚洲福利| 91国产福利在线| 日韩一区二区电影| 亚洲久本草在线中文字幕| 久久国产精品免费| 欧美做爰猛烈大尺度电影无法无天| 欧美一卡二卡三卡| 亚洲风情在线资源站| 成人美女在线观看| 日本一区二区免费在线| 久久精品国产久精国产爱| 92精品国产成人观看免费| 56国语精品自产拍在线观看| 亚洲午夜免费福利视频| 91国产精品成人| 综合网在线视频| 欧美不卡视频一区| 亚洲欧美怡红院| 视频一区二区三区中文字幕| 秋霞av亚洲一区二区三| 日本韩国视频一区二区| 亚洲欧洲另类国产综合| 91免费视频网址| 亚洲综合一区二区三区| 日韩欧美一区二区三区在线| 一区二区理论电影在线观看| 国产精品影音先锋| 国产精品麻豆久久久| 日韩欧美久久一区| 国产在线精品一区二区不卡了 | 精品电影一区二区三区| 久久er99热精品一区二区| 久久日一线二线三线suv| 国产揄拍国内精品对白| 国产精品午夜免费| 在线播放日韩导航| 蜜桃久久久久久| 欧美精品电影在线播放| 91成人看片片| 日本精品视频一区二区三区| 国产成人综合亚洲网站| 久久精品国产久精国产| 精品一区二区综合| 蜜桃一区二区三区在线| 久久精工是国产品牌吗| 男男视频亚洲欧美| 蜜臀av亚洲一区中文字幕| 天天综合色天天| 日韩精品一二三区| 日韩电影免费在线| 蜜臀av性久久久久蜜臀aⅴ四虎| 五月激情丁香一区二区三区| 天天色综合成人网| 婷婷综合在线观看| 亚洲午夜精品一区二区三区他趣| 亚洲国产一区二区三区| 日韩电影免费在线| 精品一区二区三区免费毛片爱| 国内成人免费视频| 国产精品一级黄| 99精品视频在线观看免费| 99精品一区二区| 欧美午夜理伦三级在线观看| 欧美老人xxxx18| 精品久久久久久久人人人人传媒 | 99国产精品久久久久久久久久| 91在线播放网址| 欧美日韩日日骚| 亚洲精品在线三区| 国产免费观看久久| 亚洲三级视频在线观看| 亚洲成人免费av| 精品影院一区二区久久久| 岛国精品在线播放| 一本大道综合伊人精品热热| 日韩一区二区免费在线观看| 欧美激情综合五月色丁香小说| 中文字幕一区二区三| 午夜亚洲国产au精品一区二区| 精品一区二区影视| 91免费视频大全| 日韩欧美国产小视频| 国产日韩欧美精品一区| 亚洲国产视频一区| 国产乱码字幕精品高清av| 99vv1com这只有精品| 欧美一级二级三级乱码| 中文字幕一区不卡| 蜜臀av国产精品久久久久| 99精品视频一区二区三区| 欧美人伦禁忌dvd放荡欲情| 久久久精品tv| 午夜影院在线观看欧美| 国产成人午夜电影网| 欧美日韩精品欧美日韩精品 | 激情五月激情综合网| 色综合天天综合网天天狠天天| 91精品国产入口在线| 亚洲欧美中日韩| 国内精品在线播放| 欧美性xxxxx极品少妇| 国产精品乱人伦| 久久国产麻豆精品| 欧美日韩在线不卡| 国产精品短视频| 黄页视频在线91| 777午夜精品免费视频| 自拍偷拍国产亚洲| 国产裸体歌舞团一区二区| 欧美日韩成人一区| 亚洲精品视频观看| 国产91丝袜在线18| 26uuu精品一区二区| 日精品一区二区三区| 一本久道久久综合中文字幕| 国产欧美va欧美不卡在线| 美女脱光内衣内裤视频久久网站| 欧美性大战久久久久久久蜜臀| 日韩伦理免费电影| 成人av片在线观看| 国产校园另类小说区| 久久99九九99精品| 日韩一级二级三级精品视频| 亚洲成人一区二区| 在线亚洲人成电影网站色www| 国产精品伦一区| 不卡一区在线观看| 国产精品久久久久影院老司| 国产精品66部| 国产日韩欧美一区二区三区乱码| 国产在线播放一区二区三区| 精品美女在线播放| 久久国内精品自在自线400部| 日韩视频不卡中文| 精品伊人久久久久7777人| 欧美成人一区二区三区片免费| 麻豆视频观看网址久久| 欧美一二三区在线| 蜜桃久久久久久久| 欧美精品一区二区久久婷婷| 精品一区二区三区在线观看| 精品国产凹凸成av人导航| 极品销魂美女一区二区三区| 精品嫩草影院久久| 国产福利精品导航| 日本一二三四高清不卡| 波多野结衣中文字幕一区二区三区| 国产精品色一区二区三区| 9人人澡人人爽人人精品| 亚洲美女电影在线| 欧美视频你懂的| 秋霞电影一区二区| 久久精品视频一区二区三区| 成人激情免费视频| 一区二区三区鲁丝不卡| 欧美精品第一页| 国产精品影视在线观看| 亚洲欧美在线aaa| 欧美日韩国产综合草草| 日本v片在线高清不卡在线观看| 欧美一区二区三区四区久久| 黄色日韩网站视频| 亚洲天堂2016| 777xxx欧美| 成人精品小蝌蚪| 一区二区三区四区国产精品| 欧美一区二区三区视频在线| 国产精品一二三四| 亚洲综合网站在线观看| 日韩美女一区二区三区四区| youjizz国产精品|