Click here to Skip to main content
15,896,118 members

email program fails on send with 'Exception EldProtocolReplyError

stevenandler asked:

Open original thread
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
Tags: Delphi

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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