在outlook中,要设置一个帐户有三个方面:
smtp ,pop3, user,password.四个方面,
然而我下载几个代码软件只有smtp and user??
这么回事?
是否辟开outlook重头再来的类。我总共就这么多分了,全给了!!

解决方案 »

  1.   

    CString serverAdr;   CString from;
       CString to;
    CString cc;
    CString bcc;
    CString subject;
    CString body;   GetDlgItemText( IDC_EDIT_SMTP,    serverAdr );
       GetDlgItemText( IDC_EDIT_FROM,    from );
       GetDlgItemText( IDC_EDIT_TO,      to );
       GetDlgItemText( IDC_EDIT_CC,      cc );
       GetDlgItemText( IDC_EDIT_BCC,     bcc );
       GetDlgItemText( IDC_EDIT_SUBJECT, subject );
       GetDlgItemText( IDC_EDIT_BODY,    body );   if ( to.IsEmpty() )
       {
          AfxMessageBox("Please fill -to- field");
          return;
       };   if ( subject.IsEmpty() )
       {
          AfxMessageBox("Please fill -subject- field");
          return;
       };   if ( body.IsEmpty() )
       {
          AfxMessageBox("Please write something..");
          return;
       };   if ( serverAdr.IsEmpty() )
       {
          AfxMessageBox("Please fill server field..");
          return;
       };   //*** Send
    CMIMEMessage msg;
    CSMTP smtp( serverAdr );
       
       msg.m_sFrom    = from;
    msg.m_sSubject = subject;
    msg.m_sBody    = body;
       msg.AddMultipleRecipients( to );   if ( !cc.IsEmpty() )
       {
       msg.AddMultipleRecipients( cc, CMailMessage::CC );
       }   if ( !bcc.IsEmpty() )
       {
        msg.AddMultipleRecipients( bcc, CMailMessage::BCC );
       }   //*** Here we had every attached files..
       int count = m_ListBox.GetCount();
       CString file;   for (int index = 0; index < count; index++)
       {
          m_ListBox.GetText(index, file);      msg.AddMIMEPart( file ); 
       }   //*** Set all control to disable
       EnableWindow(FALSE);   smtp.Connect();

       if (!smtp.SendMessage( &msg ))
       {
          MessageBox(smtp.GetLastError());
       }
       else
       {
          MessageBox("Sent");      SetDlgItemText( IDC_EDIT_TO, "" );
          SetDlgItemText( IDC_EDIT_CC, "" );
          SetDlgItemText( IDC_EDIT_BCC, "" );
          SetDlgItemText( IDC_EDIT_SUBJECT, "" );
          SetDlgItemText( IDC_EDIT_BODY, "" );
       }   m_ListBox.ResetContent(); smtp.Disconnect();   //*** Set all control to enable
       EnableWindow(TRUE);
    就这段代码!
      

  2.   

    发送邮件到服务器的程序,即发送邮件客户端程序;在网络上传送邮件到对方信箱的程序,即SMTP服务器程序;接受邮件并存贮给用户提取的服务器程序,即POP3服务器程序;从POP3服务器上收取邮件的程序,即接受邮件客户端程序。