My client uses some old Mitel 5.2 mail server piece of crap running on a
Linux box but that is what I have to deal with.
My test app runs fine at any location but theres.
Here is what I see when I VCN in and run my little program. It appears that
their server cannot use EHLO but it is not authenticating on HELO either.
This has become such a crises that I have to fly out there Monday. I will
go to Corporate where their mail server is located and review their logs and
attempt to send mail from my laptop locally. If it works from there, I will
go to the poultry plant and test.
I want all my guns in my holster, ready and loaded, before I leave. Can
someone tell me the actual failure and what is causing it?
Thanks
captured by my little test app
========================================
Mail Component Created at: 6/8/2007 3:25:26 PM
Host mail.marshalldurbin.com 6/8/2007 3:25:29 PM
UserID gainco 6/8/2007 3:25:29 PM
Password gainco123 6/8/2007 3:25:29 PM
SMTP Service ready
Send Cmd EHLO ENTERPRISE
Send Cmd EHLO ENTERPRISE Resp Code:-1
Send Cmd HELO ENTERPRISE
Send Cmd HELO ENTERPRISE Resp Code:250
Connected :True
Authenticated :False
mail.marshalldurbin.com pleased to meet you, ENTERPRISE
Send Cmd QUIT
Send Cmd QUIT Resp Code:221
Disconnected from Mail Server 6/8/2007 3:25:30 PM
Send Cmd QUIT Resp Code:221
Disconnected from Mail Server 6/8/2007 3:25:30 PM
============================================
Source of my test app.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
unit main;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, DBGrids, DB, StdCtrls, ExtCtrls, StatChar, ppEmail,
ppCtrls, ppBands, ppVar, ppPrnabl, ppClass, ppCache,
ppComm, ppRelatv, ppProd, ppReport, ComCtrls, Buttons, ppSMTPIndy10,
DateUtils, jpeg, Spin, ppStrtch, ppRegion;
type
TfrmMain = class(TForm)
ppReport1: TppReport;
ppTitleBand1: TppTitleBand;
ppHeaderBand1: TppHeaderBand;
ppDetailBand1: TppDetailBand;
lblStatus: TLabel;
bBtnSend: TBitBtn;
BitBtn2: TBitBtn;
ppImage1: TppImage;
ppLabel1: TppLabel;
Memo1: TMemo;
cbOpenMailDialog: TCheckBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure bBtnSendClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure RunFreqReport;
{ Private declarations }
public
{ Public declarations }
ReportCol : TppEmail;
end;
var
frmMain: TfrmMain;
implementation
{$R *.dfm}
procedure TfrmMain.bBtnSendClick(Sender: TObject);
begin
ppReport1.EmailSettings.ShowEmailDialog := (cbOpenMailDialog.State =
cbChecked);
lblStatus.Caption := 'Processing Report';
RunFreqReport;
lblStatus.caption := 'Sending Report';
ReportCol.Send;
lblStatus.caption := 'Mail Sent';
end;
procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ReportCol.Free;
end;
procedure TfrmMain.FormCreate(Sender: TObject);
begin
ReportCol:=TppEmail.Create;
Memo1.Lines.Add('Mail Component Created at: '+DateTimeToStr(Now));
end;
procedure TfrmMain.RunFreqReport;
begin
With ppReport1.EmailSettings do
Begin
FileName := 'TestSendOut.PDF';
HostAddress := 'mail.marshalldurbin.com';
UserName := 'gainco';
Password := 'gainco123';
FromAddress := 'gai...@marshalldurbin.com';
Recipients.Add('gai...@marshalldurbin.com');
Recipients.Add('jpul...@marshalldurbin.com');
Body.Add('');
Body.Add('John, If you get this notify me immediately. This is a
primitive test');
Body.Add('');
Body.Add('Mail Sent '+DateTimeToStr(Now));
Body.Add('');
Body.Add('');
Body.Add('');
Body.Add('To be added or removed from the Distribution List, please
call');
Body.Add('John Pullins');
Body.Add('');
Body.Add('');
Body.Add('');
Body.Add('');
Body.Add('');
Body.Add('');
Subject := 'Test Report for Jasper Marshall Durbin ';
end;
ReportCol.AddReport(ppReport1);
end;
END.
> I have also gone into the Indy source and "instrumentated" the
> code such that I can capture all Send Cmd along with some states.
You did not need to modify any of Indy's source code in order to do
that. Indy has a built-in reporting framework implemented. Simply
attach one of the TIdLog... components, such as TIdLogEvent, to the
TIdSMTP component. The TIdLog... component will then provide all of
the data that is transmitted in both directions.
> Here is what I see when I VCN in and run my little program. It
> appears that their server cannot use EHLO but it is not
authenticating
> on HELO either.
If the server does not support EHLO, then it likely does not support
authentication, either. EHLO is required in order for the client to
know exactly which authentication schemes are supported on the server.
> Can someone tell me the actual failure and what is causing it?
The failure is two-fold. The main issue is that the server does not
support EHLO, so TIdSMTP does not know which authentication scheme to
use. But to add to that, when the TIdSMTP.AuthType property is set to
atDefault, which forces the AUTH LOGIN scheme, TIdSMTP will not
actually try to login if the server did not report that AUTH LOGIN was
supported, which goes back to the server needing to support EHLO in
the first place.
Also, TIdSMTP does not log in automatically until Send() is actually
called, which your log does not show happening. So you would have to
call TIdSMTP.Authenticate() in your own code if you want it to log in
sooner.
Gambit
But on another note... I log into the client I mention below and set up an
E-mail account as below and send e-mail to myself. It works!!
So why doesn't the Report Builder/Indy SMTP work?
Since I am VPN'd in, I can actually run under the debugger.
I notice that SendMail never completes. The ibValid is always false! Yet I
do receive a Greeting from the Server. How is that possible if I am not
connected?
I really need to figure this one out. I am going on site Monday just for
this.
Thanks
function TppSMTPIndy.SendMail(aMessage: TppEmailMessage): Boolean;
var
lbValid: Boolean;
begin
lbValid := True;
AssignMessageToSMTP(aMessage);
if not Connected then
lbValid := Connect;
if lbValid then
begin
try
FSMTP.Send(FMessage);
except
EmailError := FSMTP.LastCmdResult.Text.Text;
frmMain.Memo1.Lines.AddStrings(FSMTP.LastCmdResult.Text); //ltk...
end;
end
Else
Result := lbValid;
end; {function, SendMail}
"Remy Lebeau (TeamB)" <no....@no.spam.com> wrote in message
news:4669dba8$1...@newsgroups.borland.com...
function TppSMTPIndy.Connect: Boolean;
begin
if not FSMTP.Connected then
begin
FSMTP.Host := Host;
FSMTP.UserName := UserID;
FSMTP.Password := Password;
frmMain.Memo1.Lines.Add('Time Before Connect :' + DateTimeToStr(Now));
//ltk...
FSMTP.Connect;
frmMain.Memo1.Lines.Add('Time After Connect :' + DateTimeToStr(Now));
//ltk...
end;
try
frmMain.Memo1.Lines.Add('Connected :' + BoolToStr(FSMTP.Connected,
true)); //ltk...
frmMain.Memo1.Lines.Add('Authenticated :' +
BoolToStr(FSMTP.Authenticate, true)); //ltk...
frmMain.Memo1.Lines.AddStrings(FSMTP.LastCmdResult.Text); //ltk...
Result := FSMTP.Connected;// and FSMTP.Authenticate;
except
Begin
EmailError := FSMTP.LastCmdResult.Text.Text;
frmMain.Memo1.Lines.AddStrings(FSMTP.LastCmdResult.Text); //ltk...
End;
end;
end; {function, Connect}
I noticed my Authenticate was always returning false because the server did
not use EHLO. Yet Digital Metaphors assumed that EHLO would always be
available. By commenting out the and FSMTP.Authenticate', I was able to
get the mail through for the first time in months.
I must admit I need to study the RFC for I don't fully understand the HELO
and EHLO aspect yet.
I don't much like my work-around and if you can think of something better, I
am open. But it'll get me up and running and may save me a long trip.
Thanks
"Ernest P. Worrell" <lki...@charter.net> wrote in message
news:466a0cc5$1...@newsgroups.borland.com...
Thanks
function TIdSMTP.Authenticate : Boolean;
var
s : TIdStrings;
begin
if FDidAuthenticate then
begin
Result := True;
frmMain.Memo1.Lines.Add('Authentication Successful
'+DateTimeToStr(Now) );// ltk...
Exit;
end;
//This will look strange but we have logic in that method to make
//sure that the STARTTLS command is used appropriately.
//Note we put this in Authenticate only to ensure that TLS negotiation
//is done before a password is sent over a network unencrypted.
StartTLS;
if Not(FDidAuthenticate) then FAuthType := atNone; <<== add the line
here
//note that we pass the reply numbers as strings so the SASL stuff can
work
//with IMAP4 and POP3 where non-numeric strings are used for reply codes
case FAuthType of
atNone:
begin
//do nothing
FDidAuthenticate := True;
end;
> I noticed my Authenticate was always returning false because
> the server did not use EHLO.
That makes sense. I told you earlier how that works.
> By commenting out the and FSMTP.Authenticate', I was
> able to get the mail through for the first time in months.
Then the server obviously does not require authentication, which I
also mentioned earlier.
Gambit
> I tried the TIdLogEvent log event but coudl not see how
> to bind it to TidSMTP.
TIdLogEvent is a TIdConnectionIntercept descendant. TIdTCPConnection
and TIdIOHandler both have a published Intercept property. If your
version of Indy 10 does not have a TIdTCPConnection.Intercept
property, then you are using an old release and should upgrade.
Otherwise, you will have to attach a TIdIOHandlerStack to the TIdSMTP
and then attach the TIdLogEvent to the TIdIOHandlerStack.
> But on another note... I log into the client I mention below and set
up an
> E-mail account as below and send e-mail to myself. It works!!
>
> So why doesn't the Report Builder/Indy SMTP work?
We already went over that earlier.
> The ibValid is always false!
The only way that can happen in the code you showed is if Connect() is
failing. TIdSMTP.Connect() does not have any return value, though, so
you are obviously not calling TIdSMTP.Connect() directly. Is
TppSMTPIndy deriving from TIdSMTP?
> Yet I do receive a Greeting from the Server. How is that possible
if I am not
> connected?
Obviously, you are connected. But the Greeting is the very first
thing received before anything else is then exchanged. So it could be
that your Connect() wrapper is detecting an error after the Greeting
and then disconnecting.
Gambit
> Here is the "fix" I am going with.
That is not a "fix" at all. You are forcing the AuthType to atNone
every time, as StartTLS() does not set the FDidAuthenticate member,
and FDidAuthenticate had to already be false for StartTLS to be
called. So you may as well just set AuthType to atNone in code before
calling Connect(), ie:
FSMTP.AuthType := atNone;
FSMTP.Connect;
> After the StartTLS call, I test for authentication and set
> the FAuthType to atNone if not authenticated.
StartTLS() does not perform any authentication to begin with. All it
does is establishes SSL encryption for the connection. Authentication
is a completely separate and unrelated operation.
Gambit