代码着色测试 //Delphi 代码:
program Project1;
{$APPTYPE CONSOLE}
idsmtp1.Host:='smtp.qq.com'; //指定发送主机
idsmtp1.Port:=25;//定义端口
idsmtp1.Username:='用户名';
idsmtp1.Password:='密码';
IdMessage1.Subject:=edit2.Text;//发送的主题
IdMessage1.Body.Text:=mmo1.Text;//发送的内容
IdMessage1.CharSet:='gb2312';//发送的文字编码
IdMessage1.From.Address:='发送者邮箱';
IdMessage1.Recipients.EMailAddresses:=Edit1.Text;//目的地地址
try
idsmtp1.Connect;
try
idsmtp1.Send(IdMessage1);
Text:='send success';
except
Text:='send field';
end;
finally
idsmtp1.Disconnect;
end;