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 := '[email protected]';
// Password := 'pass';
// Host := 'smtp.gmail.com';
// IOHandler := IdSSLIOHandlerSocketOpenSSL;
// Port := 587;
UserName := '[email protected]';
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 := '[email protected]';
IdMsg.Subject := 'test';
IdMsg.From.Address := '[email protected]';
IdMsg.From.Name := 'john';
Connect;
Send(IdMsg);
Disconnect;
finally
Free;
end;
finally
IdMsg.free;
end;
showmessage('done');
end;
Any help would be appricated.