void CMailDlg::OnSend()
{
// TODO: Add your control notification handler code here
//更新数据
UpdateData( TRUE );
//建立CSMTP对象
CSMTP smtp("smtp.126.com",25);
//新建CMailMessage对象,并初始化
CMailMessage msg;
msg.m_sFrom = m_User;
msg.AddMultipleRecipients( m_Sendto );
msg.m_sSubject = m_Subject;
msg.m_sBody = m_Concent;
//连接SMTP服务器
if( !smtp.Connect(m_User,m_Password) )
{
MessageBox("ERROR","连接失败!",MB_OK);
AfxMessageBox( smtp.GetLastError() );
return;
}
//发信
if( !smtp.SendMessage( &msg ) )
{
MessageBox("ERROR","发送!",MB_OK);
AfxMessageBox( smtp.GetLastError() );
return;
}
MessageBox("1","1,",MB_OK);
//断开连接
if( !smtp.Disconnect() )
{
AfxMessageBox( smtp.GetLastError() );
return;
}
AfxMessageBox( _T( "Message Sent Successfully") );
}
void CMailDlg::OnClickList(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int nItem;
///////////////
for(nItem=0;nItem<10; nItem++)
{
if(m_List.GetItemState(nItem, LVIS_SELECTED) == LVIS_SELECTED )
{
// 第i行被选中
//pop3.SetUserProperties(m_User,m_Password);
//pop3.Connect();
CMailMessage msg;
if (!pop3.GetMessage(nItem+1,&msg))
{
AfxMessageBox( pop3.GetLastError() );
return;
}
m_Body=msg.m_sBody;
}
}
UpdateData(FALSE);
*pResult = 0;
}