Time synchronization error when using SMTP to send email using Delphi?

how to send an email address with delphi 2010, for example (verefication email, password loss or any html / plain text emails).

I tried to use the following code, but when I try to send mail, I get EIdSocket Eroor with message 'Socket Error #10060 Connection Timed Out' .

 procedure TForm5.btnSendMailClick(Sender: TObject); begin //setup SMTP smtppass := ed_IdVerification.Text; SMTP.Host := 'smtp.google.com'; // Controle a distance SMTP.Port := 465; smtp.Username := ' hetallica69@gmail.com '; smtp.Password := QuotedStr(smtppass); //setup mail message MailMessage.From.Address := ' hetallica69@gmail.com '; MailMessage.Recipients.EMailAddresses := ' _rafik@live.fr '; MailMessage.Subject := 'Confirm your account'; MailMessage.Body.Text := 'Text goes here'; //send mail try try if not smtp.Connected then SMTP.Connect() ; SMTP.Send(MailMessage) ; except on E:Exception do ShowMessage(E.Message); end; finally if SMTP.Connected then SMTP.Disconnect; end; end; 
+4
source share
1 answer

The error you get means that the connection does not work on this line: SMTP.Connect() .

This usually means that the port is incorrect, the server is down, or you are unable to connect.

In this case, you do not have the ability to connect, most likely because your Internet provider is blocking the connection to this remote port.

Try sending an email from your hosted web server.

Even if you can connect, your code will not work as it is. Port 465 on the Google SMTP server requires a secure (SSL) connection. You still have to implement this. Take a look at: How to send email using SMTP and Indy 10 Gmail?

+3
source

Source: https://habr.com/ru/post/1387200/


All Articles