1,316
社区成员
发帖
与我相关
我的任务
分享
try
{
IdSMTP1->Host = "stmp.126.com";//你的邮箱服务器
IdSMTP1->Username = "username";//你的邮箱用户名
IdSMTP1->Password = "password"; //你的密码
IdSMTP1->Connect();
IdMessage1->Clear();
IdMessage1->From->Address = "username@126.com"; //你的邮箱
IdMessage1->Recipients->EMailAddresses = "another_user@126.com"; //这里要改成你的目的地邮箱
IdMessage1->Body->Add("This is the first line.");
IdMessage1->Body->Add("This is the second line.");
IdMessage1->Subject = "This is Only a Test";
IdSMTP1->Send(IdMessage1);
}
catch(Exception& e)
{
MessageBox(0,L"test",e.Message.c_str(),MB_OK);
}