就是用自带的控件啊!with NMSMTP1 do
begin
if connected then disconnect;
host:=edit1.Text ;//smtp服务器地址
port:=strtoint(edit2.Text );//端口
userID:=edit3.Text ;//用户名
try
connect;
except
begin
showmessage('连接不到服务器!');
exit;
end;
end;
postmessage.FromAddress :=edit6.Text ;//地址
postmessage.FromName :=edit7.Text ;//名字
postmessage.Subject :=edit5.Text ;//主题
postmessage.ToAddress.Add(edit4.Text );//发送到地址
postmessage.Body.Assign(memo1.Lines);//内容
try
try
sendmail;
finally
disconnect;
end;
except
begin
showmessage('邮件发送失败!');
exit;
end;
end;
end;
end;