Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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;

// This is where the Exception occurs
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
Posted
Comments
ZurdoDev 8-Nov-12 11:45am    
I don't do Delphi but since no one has answered you have you looked at the error? It's indicating some setup of the connection is not getting called.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900