Mark, you still have to connect. Here is my simple console app to
send mail via cmd line.
program BATMAIL;
{$APPTYPE CONSOLE}
{$R-,S-,Q-,D-,Y+,L+,O+}
uses
SysUtils, NmSmtp, RGUseful;
var
Smtp : TNMSMTP;
begin
Writeln (crlf, 'BATMAIL (C) Copyright 2000 Rohit Gupta', crlf);
if ParamCount = 0
then begin
Writeln ('SYNTAX is ', crlf, crlf,
'BATMAIL <host> <to> <from> <subject> <attachment>
<body>', crlf);
exit;
end
else Writeln (crlf, 'BATMAIL - Processing command');
Smtp := nil;
try
Smtp := TNMSMTP.Create (nil);
with Smtp
do begin
Host := ParamStr (1);
Port := 25;
UserId := ParamStr (3);
with PostMessage
do begin
ToAddress.Add (ParamStr (2));
Attachments.Add (ParamStr (5));
FromAddress := ParamStr (3);
Subject := ParamStr (4);
Body.Add (ParamStr(6));
if Body.Count = 0
then Body.Add ('Body');
end;
System.Writeln ('Connecting');
Connect;
try
System.Writeln ('Sending');
SendMail;
finally
System.Writeln ('Disconnecting');
Disconnect;
end;
end;
finally
Smtp.Free;
end;
end.
And the cmd line params I use are :-
C:\DELFI\UTILS\BATMAIL 10.0.0.60 [EMAIL PROTECTED]
[EMAIL PROTECTED] update ZIPALL.ZIP
where the 10.0.0.60 is the IP address of your PC on a single PC
system.
Hope that helps
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Send reply to: [EMAIL PROTECTED]
From: "Mark Howard" <[EMAIL PROTECTED]>
Subject: Re: [DUG]: Simple Email
Date sent: Mon, 11 Dec 2000 14:49:09 -0800
> OK
> Tried adding these two (actually FromAddress := '[EMAIL PROTECTED]')
> and get
> ESocketError "Host lookup failed"
> followed by
> ESocketError "Null remote address"
>
> Mark Derricutt - what is the 'myservername' in your message script?
>
> It's just occurred to me - I'm expecting this to dial a connection for me
> and then connect.
> Is the example I have given sufficient to do this? or does it assume that a
> dial-up connection to xtra has aleady been established?
>
> Mark
>
>
> ----- Original Message -----
> From: "Martin Ease" <[EMAIL PROTECTED]>
> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
> Sent: Sunday, December 10, 2000 6:03 PM
> Subject: RE: [DUG]: Simple Email
>
>
> > Mark
> >
> > Try adding the line...
> > NMSMTP1.PostMessage.FromAddress.Add('[EMAIL PROTECTED]');
> >
> > I think the line...
> > NMSMTP1.UserID := 'mhoward';
> > Is not required.
> >
> > Also useful might be...
> > NMSMTP1.PostMessage.FromName := 'Mark Howard';
> >
> > HTH
> > Martin.
> >
> > -----Original Message-----
> > From: Mark Howard [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, December 12, 2000 10:30
> > To: Multiple recipients of list delphi
> > Subject: Re: [DUG]: Simple Email
> >
> > Thanks for the example.
> >
> > I have tried the following code:
> > procedure TForm1.Button1Click(Sender: TObject);
> > begin
> > NMSMTP1.Host := 'smtp.xtra.co.nz';
> > NMSMTP1.UserID := 'mhoward';
> > // NMSMTP1.PostMessage.ToAddress.Text :=
> > '[EMAIL PROTECTED]';
> > NMSMTP1.PostMessage.ToAddress.Add('[EMAIL PROTECTED]');
> > NMSMTP1.Connect;
> > end;
> > and what I get is a "Null remote address".
> >
> >
> >
> > "WS SMTP relay" made the following
> > annotations on 12/11/00 15:03:24
> > --------------------------------------------------------------------------
> ----
> >
> > [INFO] -- Content Manager:
> > [MMSSOV] This e-mail message and any attachments are confidential to
> Sovereign Limited and subsidiaries and subject to legal privilege. If you
> have received this e-mail in error, please advise the sender immediately and
> destroy the message and any attachments. If you are not the intended
> recipient you are notified that any use, distribution, amendment, copying or
> any action taken or omitted to be taken in reliance of this message or
> attachments is prohibited.
> >
> >
> ============================================================================
> ==
> >
> > --------------------------------------------------------------------------
> -
> > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> > Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
>
> ---------------------------------------------------------------------------
> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
>
Regards
Rohit
======================================================================
CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand
PH (649) 489-2280
FX (649) 489-2290
email [EMAIL PROTECTED] or [EMAIL PROTECTED]
======================================================================
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"