문제

I am using this piece of code to mail a test message from delphi indy. I have a TidSMTP,TIdMessage and IdSSLIOHandlerSocketOpenSSL;

In the belowe code if i set it up to use gmail with ssl it works fine, but as soon as i replace my the server details with my cpanel mail server detials it does not work error:

" unable to authenticate at present".

I used same details I would use to setup my account in outlook 2007. Here is the code

IdSSLIOHandlerSocketOpenSSL details.

method := sslvsslv3
mode := sslmUnassigned

//rest default values

procedure Tfrmnotification.btnSendClick(Sender: TObject);
var
  IdMsg : TIdMessage;
begin

begin
  IdMsg := TIdMessage.Create(nil);
  try
    with TIdSMTP.Create(nil) do
    try
     // UserName := 'something@gmail.com';
     // Password := 'pass';
     // Host := 'smtp.gmail.com';
     // IOHandler := IdSSLIOHandlerSocketOpenSSL;
     // Port := 587;
      UserName := 'something@sasra.co.za';
      Password := 'password';
      Host := 'outgoing server detials';// same as outlooks
      IOHandler := IdSSLIOHandlerSocketOpenSSL;
      Port := 465;// this is correct port
      UseTLS:=  utUseExplicitTLS;


      IdMsg.Body.Add('test');
      IdMsg.Recipients.emailAddresses := 'something@gmail.com';
      IdMsg.Subject := 'test';
      IdMsg.From.Address := 'something@sasra.co.za';
      IdMsg.From.Name := 'john';


      Connect;
      Send(IdMsg);
      Disconnect;
    finally
      Free;
    end;
  finally
    IdMsg.free;
  end;
  showmessage('done');
end;

Any help would be appricated.

도움이 되었습니까?

해결책

Port 465 is used for SMTP over implicit SSL. You have set UseTLS to utUseExplicitTLS. The correct value should (most likely) be utUseImplicitTLS.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top