我用POP3收邮件为什么老登不上服务器?
我的程序代码是
BOOL CMyapi::Connect(CString & Server, CString & User, CString & Password)
{
char buf[512];
if (!m_PopServer.Connect(Server,110)) // 110 Pop3 Port
{
m_ErrorMessage = _T("Server cannot be connected");
return FALSE;
}
else
{
if(CheckResponse(0)==FALSE)
return FALSE;
wsprintf (buf, "USER %s\r\n", (LPCSTR) User);
m_PopServer.Send(buf, strlen (buf));
if(CheckResponse(1)==FALSE)
return FALSE;
wsprintf (buf, "PASS %s\r\n", (LPCSTR) Password);
m_PopServer.Send(buf, strlen (buf));
if (CheckResponse(2)==FALSE)
return FALSE;
else
printf("fkdkfdfkdkf");
return TRUE;
}
}
void CStmpDlg::OnLogin()
{
CMyapi mail;
// TODO: Add your control notification handler code here
UpdateData(TRUE);
if (m_ServerName.IsEmpty()!=0)
MessageBox("Please input your server name!");
else if(m_UserName.IsEmpty()!=0)
MessageBox("Please input your user name!");
else if(m_Password.IsEmpty()!=0)
MessageBox("Please input your password!");
else
{
if(mail.Connect (m_ServerName,m_UserName,m_Password))
AfxMessageBox(mail.GetMsgContents());
else
AfxMessageBox(mail.GetErrorMessage());
}