vc下基于SMTP协议的发送电子邮件代码
struct response_code
{
//如果没有得到回应信息,则给出出错信息
UINT nResponse;
TCHAR* sMessage;
};
enum eResponse
{
GENERIC_SUCCESS=0,
CONNECT_SUCCESS,
DATA_SUCCESS,
QUIT_SUCESS,
//LAST_RESSONSE 是最后一个元素
LAST_RESSONSE
};
TCHAR *response_buf;
Static response_code response_table[];
};
Viod CMailDlg::OnSend()
{
//获得用户填入的信息
CString strServerAddress,strFrom,strTo,strCopyTo;
CString strSend,strTitle,strContent;
GetDlgItemText(IDC_EDIT_SMTP,strServerAddress);
GetDlgItemText(IDC_EDIT_FROM,strFrom);
GetDlgItemText(IDC_EDIT_TO,strTo);
GetDlgItemText(IDC_EDIT_CC,strCopyTo);
GetDlgItemText(IDC_EDIT_BCC,strSend);
GetDlgItemText(IDC_EDIT_SUBJECT,strTitle);
GetDlgItemText(IDC_EDIT_BODY,strContent);
If (strTo.IsEmpty())
{
//收信人地址为空
AfxMessageBox(_T("请填写收信人地址"));
Return;
}