Delphi + TidSMTP.Connect + Socket Error 10054 - Connection Reset by Peer

4.3k views Asked by At

I have a Delphi application which uses TidSMTP to send emails, well is supposed to. When tested on our local mail server it works fine but as soon as I set it up to work with the external mail server I get the socket error 10054 - Connection Reset by Peer when it trys to perfrom the l_idSMTP.connect line of code

I have setup the account I wish to use to send emails in Outlook on the same machine and it is able to successfully send emails so I am not sure why the Delphi application on the same machine is not?

Below is my code

    try
      l_pConfigurator := TConfigurator.Create;
      l_idSMTP.Username := l_pConfigurator.SMTPUser;
      l_idSMTP.Password := l_pConfigurator.SMTPPass;
      l_idSMTP.Host     := l_pConfigurator.SMTPHost;
      l_idSMTP.Port     := strtoint(l_pConfigurator.SMTPPort);
      if l_pConfigurator.SMTPAuth = 'LOGIN' then
      begin
        l_idSMTP.AuthenticationType := atLogin;
      end;
    finally
      FreeAndNil(l_pConfigurator);
    end;

    l_idSMTP.Connect(30000);

    if l_idSMTP.Connected then 
      l_idSMTP.Send(l_idMsg);

Any assistance will be greatly appreciated

0

There are 0 answers