一个对话框程序,如:
void CEmailDlg::OnButton1()
{
// TODO: Add your control notification handler code here
typedef CMC_return_code (CALLBACK* lpfnCMC_LOGON)
(
CMC_string service,
CMC_string user,
CMC_string password,
CMC_object_identifier character_set,
CMC_ui_id ui_id,
CMC_uint16 caller_CMC_version,
CMC_flags logon_flags,
CMC_session_id FAR * session,
CMC_extension FAR * logon_extensions
);
lpfnCMC_LOGON lpfnCmc_logon = NULL;
HMODULE hMAPILib = LoadLibrary("MAPI32.DLL");
lpfnCmc_logon = (lpfnCMC_LOGON)GetProcAddress(hMAPILib, "cmc_logon");
CMC_return_code cmcStatus;
CMC_session_id cmcSession;
cmcStatus = (*lpfnCmc_logon)(
"pop3.sina.com.cn",//这里改为smtp.sina.com.cn或http://www.sina.com.cn都不行
"abcdef", //这个是例如
"7654321", //这个也是例如,因这是个人Email的秘密
NULL,
0,
CMC_VERSION,
CMC_LOGON_UI_ALLOWED | CMC_ERROR_UI_ALLOWED ,
&cmcSession,
NULL);
if(cmcStatus != CMC_SUCCESS) //经过验证返回值为8
AfxMessageBox("登陆不到!");
}
void CEmailDlg::OnButton1()
{
// TODO: Add your control notification handler code here
typedef CMC_return_code (CALLBACK* lpfnCMC_LOGON)
(
CMC_string service,
CMC_string user,
CMC_string password,
CMC_object_identifier character_set,
CMC_ui_id ui_id,
CMC_uint16 caller_CMC_version,
CMC_flags logon_flags,
CMC_session_id FAR * session,
CMC_extension FAR * logon_extensions
);
lpfnCMC_LOGON lpfnCmc_logon = NULL;
HMODULE hMAPILib = LoadLibrary("MAPI32.DLL");
lpfnCmc_logon = (lpfnCMC_LOGON)GetProcAddress(hMAPILib, "cmc_logon");
CMC_return_code cmcStatus;
CMC_session_id cmcSession;
cmcStatus = (*lpfnCmc_logon)(
"pop3.sina.com.cn",//这里改为smtp.sina.com.cn或http://www.sina.com.cn都不行
"abcdef", //这个是例如
"7654321", //这个也是例如,因这是个人Email的秘密
NULL,
0,
CMC_VERSION,
CMC_LOGON_UI_ALLOWED | CMC_ERROR_UI_ALLOWED ,
&cmcSession,
NULL);
if(cmcStatus != CMC_SUCCESS) //经过验证返回值为8
AfxMessageBox("登陆不到!");
}
至于下面的问题要等我解决我自己的问题才能回答。因我的MAPI也是刚接触,如果连一个EMAIL都发不出就惭答你的问题了。