Click here to Skip to main content
11,718,016 members (82,594 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Delphi
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 6-Nov-12 11:33am
Comments
ryanb31 at 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)

  Print Answers RSS
0 OriginalGriff 215
1 F-ES Sitecore 210
2 Maciej Los 140
3 Jochen Arndt 120
4 Andy Lanng 115
0 Sergey Alexandrovich Kryukov 1,649
1 OriginalGriff 535
2 Maciej Los 529
3 Richard MacCutchan 440
4 CHill60 415


Advertise | Privacy | Mobile
Web03 | 2.8.150901.1 | Last Updated 6 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100