jrgeralde
  • jrgeralde
  • 50.75% (Neutral)
  • Newbie Topic Starter
4 years ago
Failed to send email with the following error. Error with connecting server; socket error:0x00002746


oSMTP.ServerAddr := 'smtp.gmail.com';
oSMTP.ServerPort := 465;
oSMTP.FromAddr:=email;
oSMTP.Subject :='Payslip for the period:';

osmtp.Username:=email;
oSMTP.Password := smtppassword;
oSMTP.ConnectType:=4;


oSMTP.BodyText:='Please see attached file for payslip details..';


fname :='.\Payslips\payslip.pdf';

if FileExists(fname) then
oSMTP.AddAttachment(fname);

//send mail

if oSMTP.SendMail()= 0 then begin
result := True;
end else begin
ShowMessage('failed to send email with the following error: '
+ oSmtp.GetLastErrDescription());
result := False;
end;


ivan
  • ivan
  • 100% (Exalted)
  • Administration
4 years ago
If you use 465 port, please use ConnectType := 1

ConnectType := 4 is for 25/587 port.


  ConnectNormal = 0;
  ConnectSSLAuto = 1;
  ConnectSTARTTLS = 2;
  ConnectDirectSSL = 3;
  ConnectTryTLS = 4;

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.