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

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

?? maildlg.cpp

?? 我覓得的關于簡單郵件傳輸協議SMTP
?? CPP
字號:
// MailDlg.cpp : implementation file
//

#include "stdafx.h"
#include "SendMail.h"
#include "MailDlg.h"
#include "ServDlg.h"
#include "socketx.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif



/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMailDlg dialog

CMailDlg::CMailDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CMailDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CMailDlg)
	m_strMessage = _T("");
	m_strToAddress = _T("");
	m_strSubject = _T("");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CMailDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMailDlg)
	DDX_Text(pDX, IDC_MESSAGE_BODY, m_strMessage);
	DDX_Text(pDX, IDC_TO_ADDRESS, m_strToAddress);
	DDX_Text(pDX, IDC_SUBJECT, m_strSubject);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CMailDlg, CDialog)
	//{{AFX_MSG_MAP(CMailDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_SEND_MAIL, OnSendMail)
	ON_BN_CLICKED(IDC_SMTP_INFO, OnSmtpInfo)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMailDlg message handlers

BOOL CMailDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

void CMailDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CMailDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CMailDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CMailDlg::OnSmtpInfo() 
{
	CServerDialog dlg;
	dlg.DoModal();
}

void CMailDlg::OnSendMail() 
{
	UpdateData(TRUE);

	// Has a to address and message been entered?
	if (m_strToAddress.IsEmpty())
	{
		CWnd *pWnd = GetDlgItem(IDC_TO_ADDRESS);
		if (pWnd)
			pWnd->SetFocus();
		AfxMessageBox("Please enter a TO: address");
		return;
	}
	if (m_strMessage.IsEmpty())
	{
		CWnd *pWnd = GetDlgItem(IDC_MESSAGE_BODY);
		if (pWnd)
			pWnd->SetFocus();
		AfxMessageBox("Please enter a message");
		return;
	}

	// Retrieve the SMTP Info
	CString strServer;
	CString strFrom;
	CSendMailApp* pApp = (CSendMailApp*)AfxGetApp();
	pApp->GetSmtpInfo(strServer, strFrom);

	// If the SMTP info hasn't been filled in
	// Show the SMTP dialog
	if (strServer.IsEmpty() || strFrom.IsEmpty())
	{
		CServerDialog dlg;
		// Loop until we have the info or the user cancels
		while(1)
		{
			if (dlg.DoModal() != IDOK)
				return;
			if (!dlg.m_strServer.IsEmpty() && 
			    !dlg.m_strFrom.IsEmpty())
			{
				strServer = dlg.m_strServer;
				strFrom   = dlg.m_strFrom;
				break;
			}
		}
	}

	// Display an hour glass while
	// we're working
	CWaitCursor wait;

	// Send the message to the server
	BOOL bRet = SendMailMessage(strServer,
							    strFrom,
								m_strToAddress,
								m_strSubject,
								m_strMessage);
	// If send was successful
	if (bRet)
	{
		// Tell the user
		AfxMessageBox("Message Sent");
		// Clear out the edit boxes
		m_strToAddress = "";
		m_strSubject = "";
		m_strMessage = "";
		UpdateData(FALSE);
		// And place the caret back in the To: line
		CWnd *pWnd = GetDlgItem(IDC_TO_ADDRESS);
		if (pWnd)
			pWnd->SetFocus();
	}
}

void CMailDlg::ReportSocketError(int nError)
{
	CString strError;
	strError.LoadString(nError);
	AfxMessageBox(strError);
}


// 
// SendMailMessage()
// Sends an email message through
// an SMTP server.
// Accepts all needed info as parameters
// to make it easier to steal.
//
//
BOOL CMailDlg::SendMailMessage(LPCTSTR szServer, 
							   LPCTSTR szFrom, 
							   LPCTSTR szTo, 
							   LPCTSTR szSubject, 
							   LPCTSTR szMessage)
{
	// Construct a socket from the derived class
	CSocketX theSocket;

	// And create the socket descriptor
	if (!theSocket.Create())
	{
		AfxMessageBox("Socket creation failed");
		return FALSE;
	} 

	// Connect to the server
	if (!theSocket.Connect(szServer, 25))
	{
		AfxMessageBox("Could not connect to server");
		return FALSE;
	}

	// General purpose strings
	CString strCommand;
	CString strResponse;

	// Set timeout to 10 seconds
	UINT uTimeOut = 10000;

	// Read the "HELO" response from the server
	if (theSocket.Receive(strResponse, uTimeOut) == SOCKET_ERROR)
	{
		ReportSocketError(theSocket.GetLastError());
		return FALSE;
	}

	// and check to see if we're talking to an
	// SMTP server
	if (strResponse.Left(3) != _T("220"))
	{
		CString strError = "ERROR: Not a valid SMTP server response\r\n";
		strError += strResponse;
		AfxMessageBox(strError);
		theSocket.Send("QUIT\r\n");
		return FALSE;
	}

	// Send the "FROM" line
	strCommand = "MAIL FROM:<";
	strCommand += szFrom;
	strCommand += ">\r\n";
	theSocket.Send(strCommand);
	
	// and check the response
	if (theSocket.Receive(strResponse, uTimeOut) == SOCKET_ERROR)
	{
		ReportSocketError(theSocket.GetLastError());
		return FALSE;
	}
	if (strResponse.Left(3) != _T("250"))
	{
		CString strError = "ERROR: Sender rejected\r\n";
		strError += strResponse;
		AfxMessageBox(strError);
		theSocket.Send("QUIT\r\n");
		return FALSE;
	}

	// Send the "RCPT" line
	strCommand = "RCPT TO:<";
	strCommand += szTo;
	strCommand += ">\r\n";
	theSocket.Send(strCommand);

	// and check the response
	if (theSocket.Receive(strResponse, uTimeOut) == SOCKET_ERROR)
	{
		ReportSocketError(theSocket.GetLastError());
		return FALSE;
	}
	if (strResponse.Left(3) != _T("250"))
	{
		CString strError = "ERROR: Recipient rejected\r\n";
		strError += strResponse;
		AfxMessageBox(strError);
		theSocket.Send("QUIT\r\n");
		return FALSE;
	}

	// Send the "DATA" line
	theSocket.Send("DATA\r\n");

	// and check the response
	if (theSocket.Receive(strResponse, uTimeOut) == SOCKET_ERROR)
	{
		ReportSocketError(theSocket.GetLastError());
		return FALSE;
	}
	if (strResponse.Left(3) != _T("354"))
	{
		CString strError = "ERROR: DATA command rejected\r\n";
		strError += strResponse;
		AfxMessageBox(strError);
		theSocket.Send("QUIT\r\n");
		return FALSE;
	}

	// Send the "Subject" line
	strCommand = "Subject: ";
	strCommand += szSubject;
	strCommand += "\r\n";
	theSocket.Send(strCommand);

	// No response from server expectd

	// Send the message data
	// This code assumes the message
	// data contains CRLF pairs 
	// where appropriate.
	if (theSocket.Send(szMessage) == SOCKET_ERROR)
	{
		ReportSocketError(theSocket.GetLastError());
		return FALSE;
	}

	// No response from server expectd

	// Send the termination line
	theSocket.Send("\r\n.\r\n");

	// and check the response
	if (theSocket.Receive(strResponse, uTimeOut) == SOCKET_ERROR)
	{
		ReportSocketError(theSocket.GetLastError());
		return FALSE;
	}
	if (strResponse.Left(3) != _T("250"))
	{
		CString strError = "ERROR: Message body rejected\r\n";
		strError += strResponse;
		AfxMessageBox(strError);
		theSocket.Send("QUIT\r\n");
		return FALSE;
	}

	// Send the "QUIT" line
	theSocket.Send("QUIT\r\n");

	return TRUE;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
男人的天堂久久精品| 中文字幕一区二区三中文字幕| 亚洲国产精品一区二区久久恐怖片 | 国产一区999| 久久这里只有精品首页| 粉嫩av亚洲一区二区图片| 国产精品乱码人人做人人爱 | 粉嫩蜜臀av国产精品网站| 中文在线资源观看网站视频免费不卡| 国产白丝精品91爽爽久久| 国产精品乱人伦| 91搞黄在线观看| 日本中文字幕一区二区有限公司| 欧美va天堂va视频va在线| 国产精品一级在线| 国产精品国产三级国产三级人妇| 色综合久久综合网欧美综合网| 樱桃视频在线观看一区| 日本韩国一区二区三区视频| 亚洲成人精品一区| 91麻豆精品国产91久久久资源速度 | 欧美一区日韩一区| 久久精品国产77777蜜臀| 精品国产乱码久久久久久影片| 国产精品18久久久久久久久| 国产精品成人一区二区三区夜夜夜 | 成人激情黄色小说| 亚洲va在线va天堂| 国产日韩欧美精品综合| 在线观看网站黄不卡| 久久69国产一区二区蜜臀| 中文字幕一区二区三区av| 欧美精品久久久久久久多人混战 | 亚洲国产一区视频| 久久久亚洲精品石原莉奈| 色婷婷亚洲婷婷| 国内不卡的二区三区中文字幕| 亚洲三级在线观看| 亚洲精品一区二区三区四区高清 | 国产精品蜜臀在线观看| 欧美日韩一级视频| 成人激情黄色小说| 美女在线一区二区| 亚洲欧美视频在线观看视频| 日韩小视频在线观看专区| av中文字幕在线不卡| 久久精品国产99国产精品| 伊人一区二区三区| 国产网站一区二区| 欧美电影在哪看比较好| 91美女在线视频| 国产一区二区视频在线播放| 一区二区三区欧美| 中文字幕精品在线不卡| 精品成人a区在线观看| 91国产精品成人| 国产成人精品综合在线观看| 日韩av成人高清| 亚洲香蕉伊在人在线观| 国产精品成人免费在线| 久久人人爽人人爽| 日韩欧美国产一区二区在线播放 | 狠狠色丁香九九婷婷综合五月| 一区二区三区精密机械公司| 国产午夜精品久久久久久免费视| 91精品国产乱| 欧美精品v日韩精品v韩国精品v| 99久久精品免费| 国产二区国产一区在线观看| 久久疯狂做爰流白浆xx| 蜜臀av性久久久久蜜臀av麻豆| 亚洲国产成人av| 亚洲第一在线综合网站| 午夜视频久久久久久| 一区二区三区欧美视频| 亚洲美女精品一区| 亚洲日本在线看| 亚洲欧美精品午睡沙发| 亚洲三级在线免费| 曰韩精品一区二区| 亚洲影院久久精品| 亚洲国产欧美日韩另类综合 | 美女一区二区久久| 免费看日韩a级影片| 久久福利视频一区二区| 国产精品亚洲午夜一区二区三区| 国产成a人亚洲| 成人黄色片在线观看| www.欧美亚洲| 欧美性感一区二区三区| 7799精品视频| 日韩免费视频一区二区| 国产亚洲欧美日韩俺去了| 中文字幕亚洲视频| 夜夜嗨av一区二区三区网页| 亚洲一区二区三区小说| 日韩成人免费看| 国产精品伊人色| 色综合久久久久| 日韩一级免费一区| 中文字幕第一区二区| 午夜久久久久久久久| 石原莉奈一区二区三区在线观看| 日本中文字幕不卡| 国产91精品一区二区麻豆网站| 成年人国产精品| 欧美日韩一区小说| 日韩三级在线免费观看| 亚洲国产经典视频| 亚洲综合色视频| 久草这里只有精品视频| www.一区二区| 欧美一区二区久久| 国产三级欧美三级日产三级99| 国产精品精品国产色婷婷| 午夜精品福利一区二区三区av| 紧缚捆绑精品一区二区| 91麻豆免费观看| 日韩精品中文字幕在线不卡尤物 | 精品一区二区三区免费观看| 丁香婷婷综合激情五月色| 欧美伊人久久久久久午夜久久久久| 欧美乱妇一区二区三区不卡视频| 精品蜜桃在线看| 成人欧美一区二区三区在线播放| 天堂午夜影视日韩欧美一区二区| 国产一区二区剧情av在线| 91国在线观看| 国产欧美精品一区| 毛片一区二区三区| 日本国产一区二区| 国产午夜精品理论片a级大结局| 亚洲最色的网站| 国产一区二区三区黄视频| 欧美三级资源在线| 最新热久久免费视频| 久久精品999| 欧美男男青年gay1069videost| 日本一区二区综合亚洲| 日韩电影在线观看电影| 91性感美女视频| 国产精品嫩草影院com| 奇米888四色在线精品| 欧美影院一区二区| 中文字幕亚洲一区二区av在线| 久久国产成人午夜av影院| 欧美性猛交xxxx黑人交| 综合亚洲深深色噜噜狠狠网站| 国产在线播精品第三| 91精品国产综合久久久久久| 亚洲精品国产无天堂网2021| 国产成人在线影院| 26uuu色噜噜精品一区二区| 日韩精品成人一区二区三区| 91片在线免费观看| 国产欧美日韩另类一区| 高清国产一区二区三区| 精品日韩一区二区三区 | 日韩欧美国产一二三区| 首页国产丝袜综合| 欧美三级午夜理伦三级中视频| 国产精品午夜在线观看| 极品少妇xxxx精品少妇偷拍| 欧美一区二区视频在线观看2020| 夜夜嗨av一区二区三区网页 | 七七婷婷婷婷精品国产| 欧美老肥妇做.爰bbww| 一区二区欧美精品| 欧美日韩情趣电影| 亚洲成人动漫av| 6080亚洲精品一区二区| 日韩一区欧美二区| 欧美精品三级在线观看| 日本中文字幕一区二区有限公司| 欧美肥胖老妇做爰| 美女视频网站黄色亚洲| 欧美一级搡bbbb搡bbbb| 青草国产精品久久久久久| 欧美一区二区日韩一区二区| 日韩国产欧美三级| 日韩亚洲欧美在线观看| 国产在线看一区| 国产精品卡一卡二| 91黄色小视频| 全部av―极品视觉盛宴亚洲| 欧美成人激情免费网| 国产精品影视在线观看| 国产精品久久久久一区二区三区共| 99久久国产综合精品女不卡| 一区二区三区免费网站| 777xxx欧美| 国产精品伊人色| 亚洲卡通动漫在线| 欧美日韩精品欧美日韩精品一 | 欧美三级日韩三级| 狂野欧美性猛交blacked| 欧美激情在线一区二区三区| 色婷婷av一区二区三区软件| 奇米影视一区二区三区小说| 国产三级精品三级在线专区|