Hi,
I am trying to send an email using the indy components and I seem to be getting the error 'Socket Error # 10060 Connection timed out'. I am just trying to send a test email to myself. and I am using smtp.googlemail.co.uk as the host name with my username and password. I thought the firewall might be getting in the way so i tried disabling it and still the same thing happens. Any ideas?
When stepping-through I notice that the atLogin authenticationType is executed and that the code breaks on the EmailSMTP.Connect; part.
Any help would be greatly appreciated.
Regards
BebopSong
I am trying to send an email using the indy components and I seem to be getting the error 'Socket Error # 10060 Connection timed out'. I am just trying to send a test email to myself. and I am using smtp.googlemail.co.uk as the host name with my username and password. I thought the firewall might be getting in the way so i tried disabling it and still the same thing happens. Any ideas?
Code:
procedure TfrmMaintenance.btnTestClick(Sender: TObject);
var Prob: boolean;
begin
if chkInternet.Checked then exit;
prob := false;
if tblSecurity.state in [dsEdit,dsInsert] then tblSecurity.post;
try
EmailMess.ClearBody;
EmailMess.Body.Add('Test email');
EmailMess.Subject := 'Email Test';
EmailMess.Recipients.EMailAddresses := tblSecurity.FieldByName('SenderEmail').AsString;
if tblSecurity.FieldByName('AuthServer').AsBoolean then
EmailSMTP.AuthenticationType := atLogin
else
EmailSMTP.AuthenticationType := atNone;
EmailMess.From.Address := tblSecurity.FieldByName('SenderEmail').AsString;
EmailMess.Sender.Address := tblSecurity.FieldByName('SenderEmail').AsString;
EmailSMTP.host := tblSecurity.FieldByName('HostServer').AsString;
EmailSMTP.UserName := tblSecurity.FieldByName('UserName').AsString;
EmailSMTP.Password := tblSecurity.FieldByName('UserPassword').AsString;
if EmailSMTP.Connected then
EmailSMTP.Disconnect;
EmailSMTP.Connect;
EmailSMTP.Send(EmailMess);
EmailSMTP.Disconnect;
except
Application.HandleException(Self);
prob := true;
end;
end;
Any help would be greatly appreciated.
Regards
BebopSong