0

首先,我有这段代码,我尝试使用 Gmail Smtp 服务器,但结果出现错误异常:Socket °10060 !!!这是一个延迟套接字错误,如果有人之前尝试过这个并且对他有用,请与我分享这个想法,谢谢!!!!

 VAR SMTP : TIdSMTP;  VAR MSG : TIdMSG;
 MSG:=TIdMSG.Create(NIL);

 TRY
    WITH MSG.Recipients.Add DO BEGIN
  Name:='<Name of recipient>';
  Address:='<Email address of recipient>'
END;
MSG.BccList.Add.Address:='<Email address of Blind Copy recipient>';
MSG.From.Name:='<Name of sender>';
MSG.From.Address:='<Email address of sender>';
MSG.Body.Text:='<Message Body>';
MSG.Subject:='<Subject of message>';
SMTP:=TIdSMTP.Create(NIL);
TRY
  SMTP.Host:='x.x.x.x'; // IP Address of SMTP server
  SMTP.Port:=25; // Port address of SMTP service (usually 25)
  SMTP.Connect;
  TRY
    SMTP.Send(MSG)
  FINALLY
    SMTP.Disconnect
  END
FINALLY
  SMTP.Free
END

最后MSG.Free END;

4

0 回答 0