问题描述
以下是我的smtp客户端发送电子邮件的代码
Following is my code for the smtp client for sending email
VAR SMTP : TIdSMTP;
MSG : TIdmessage;
begin
MSG:=TIdmessage.Create(NIL);
TRY
WITH MSG.Recipients.Add DO BEGIN
Name:='me025';
Address:='[email protected]'
END;
MSG.BccList.Add.Address:='[email protected]';
MSG.From.Name:='self025';
MSG.From.Address:='[email protected]';
MSG.Body.Text:='<Message Body>';
MSG.Subject:='<Subject of message>';
SMTP:=TIdSMTP.Create(NIL);
TRY
SMTP.Host:='127.0.1.1'; // IP Address of SMTP server
// 127.0.1.1
SMTP.Port:=25; // Port address of SMTP service (usually 25)
SMTP.Connect;
TRY
SMTP.Send(MSG)
FINALLY
SMTP.Disconnect
END
FINALLY
SMTP.Free
END
FINALLY
MSG.Free
END;
end;
将在同一台PC中使用SMTP服务器
which will use a SMTPserver in same pc
smtp服务器是运行中的indy 10非官方示例
the smtp server is a working indy 10 unofficial samplehttp://indy.fulgan.com/ZIP/Indy10demo.zip
每当我连接到服务器时,套接字错误#11001主机未找到错误发生地点
whenever i connect to the server "Socket error # 11001 Host not found " error occers
,但smtp服务器正确接收了所有参数并在GUI上正确显示
but smtp server is receiving all the parameters correctly and showing correctly on the GUI
推荐答案
有您的PC地址为127.0.1.1,还是尝试使用localhost(127.0.0.1)?人们应该习惯于DNS名称...一旦IPv6成为主流,至少人们将不再容易记住IP号了:)
Has your PC an address of 127.0.1.1 or are you trying to use localhost (127.0.0.1)? People should get used to DNS names... as soon as IPv6 will become mainstream at least people won't be able any longer to remember IP numbers easily :)
这篇关于Indy Mail服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!