A
aikede
Unregistered / Unconfirmed
GUEST, unregistred user!
下面这段发GMail邮件的代码老是报#11001 host not found,大家有知道原因的不?procedure TForm2.BitBtn1Click(Sender: TObject);begin with IdSSLIOHandlerSocketOpenSSL1 do begin Destination := 'smtp.gmail.com:587'; Host := 'smtp.gmail.com'; //MaxLineAction :=maException; Port := 587 ; //SSLOptions.Method := sslvTLSv1; //SSLOptions.Method :=sslvSSLv2; //SSLOptions.Mode := sslmUnassigned; //SSLOptions.Mode := sslmClient; end; SMTP.IOHandler:=IdSSLIOHandlerSocketOpenSSL1; SMTP.Host := 'smtp.gmail.com'; SMTP.Port :=587; SMTP.AuthType := satNone; SMTP.UserName := 'myactorai@gmail.com'; SMTP.Password := 'XXXXX'; SMTP.UseTLS:= utUseImplicitTLS; // 设置邮件的信息 MailMessage.From.Address := 'actorai@gmail.com'; MailMessage.Recipients.EMailAddresses := 'actorai@163.com'; MailMessage.Subject := 'test'; MailMessage.Body.Text := 'aaaaaaaaaaaa,bbbbbbbb'; //发送邮件 try try SMTP.Connect; SMTP.Send(MailMessage); ShowMessage('发送成功'); except on E:Exception do ShowMessage('发送失败: ' + E.Message); end; finally if SMTP.Connected then SMTP.Disconnect; end;end;