The following is a very basic email program program I wrote using Delph 7.
The program bombs out when executing
SMTP.Send(Email);
The message is
Exception EldProtocolReplyError in Module SendEmail.exe at 00025AB4.
5.7.0 Must issue a STARTTLS command first. co1sm11098818vdc.10
program SendEmail;
{$APPTYPE CONSOLE}
uses
SysUtils,IdSMTP,IdMessage;
Var
SMTP : TIdSMTP;
Email: TIdMessage;
begin
SMTP := TIdSMTP.Create(nil);
Email := TIdMessage.Create(nil);
try
SMTP.Host := 'smtp.gmail.com';
SMTP.Port := 25;
SMTP.Username := 'username';
SMTP.Password := 'password';
Email.From.Address := 'steven@gmail.com';
Email.Recipients.EMailAddresses := 'steven@gmail.com';
Email.Subject := 'system message';
Email.Body.Text := 'Hello, It is Just for test';
SMTP.Connect;
SMTP.Send(Email);
finally
SMTP.Free;
Email.Free;
end;
readln;
end.
Please advice me what I need to do to make this program run.
Thank you