Issue with Indy SMTP Client/Engine ?



Hello Everyone

I have a shareware app - and I have put in the ability to send an email
from batch mode in the application. However, I have been having some
issues with it lately.

I am using D6 - and the Indy 10 components (TIdSmtp). When I send an
email - I am now getting back the message "554 We do not accept messages
with no From To or Subject Headers". (I believe this is coming back
from my SMTP Server and being displayed by McAfee)

I checked the code - and I am supplying a From Addres, To Address and a
Subject Line. I take it that the headers referr to something else?

I have put the code I am using below...


What I am looking for is something simple that I can use. I want to
give it a Server to use, the email body and subject - and the file name
to attach...
This is not a core part of my app - but it is useful for the users. I
don't want to spend a lot of time on it if possible.


Are there any SMTP routines out there that will do this?
Are there SMTP Servers that I can embed in my app that will handle this?
(Although that probably will introduce more issus <g>)

Does anyone familiar with Indy know what I am missing from the code
below?

Any thoughts would be appreciated


--

G. Bradley MacDonald
bradley_AT_telus_DOT_net


Function I use
-------------------------------------------

procedure SendEmailViaSMTP(Const ToEmail :String;
Const FromEmail :String;
Const BodyText :String;
Const SubjectText :String;
Const ServerAddress :String;
Const UserId :String;
Const Password :String;
Const FileName :String
);
Var
Smtp :TIdSMTP;
MSG :TIdMessage;
begin

Smtp := TIdSmtp.Create(Nil);
Msg := TIdMessage.Create(Nil);
// Now this is where we get things done.
Try
If (FileName <> '') then Begin
TIdAttachmentFile.Create(Msg.MessageParts, FileName);
end;

with Msg do
begin
Body.Add(BodyText);
From.Text := FromEmail;
Recipients.EMailAddresses := ToEmail;
Subject := SubjectText;
Priority := mpNormal;
CCList.EMailAddresses := '';
BccList.EMailAddresses := '';
ReceiptRecipient.Text := '';
end;

{authentication settings}
SMTP.AuthType := atNone;
SMTP.UserName := UserId;
SMTP.Password := Password;

{General setup}
SMTP.Host := ServerAddress;
SMTP.Port := 25;

{now we send the message}
Try
SMTP.Connect;
try
SMTP.Send(Msg);
finally
SMTP.Disconnect;
end; // Try..Finally
Except
on E: Exception do Begin
ShowMessage('Error Sending SMTP eMail'
+ #13#10 + #13#10
+ 'Make sure this machine is connected to the
Internet.'
+ #13#10 + #13#10
+ 'Original Message: ' + E.Message
);
End; // On E
End; // Try..Except
Finally
Smtp.Free;
Msg.Free;
End;
end; // SMTP Mail

.



Relevant Pages

  • SMTP Errors
    ... I've written a smal vb app that sends email via SMTP. ... The message could not be sent to the SMTP server. ... Prev by Date: ...
    (microsoft.public.windows.server.sbs)
  • Re: A flood of spams - another virus on the way?
    ... > If you are talking about HP.com's SMTP service, ... Yet another effect of Spam. ... by the time the SMTP server has gone into DATA mode to ... he'll most likely get the NO SUCH USER response. ...
    (comp.os.vms)
  • Re: Font in Inbox larger........
    ... SMTP server, and I don't recall what that server name is. ... Gary VanderMolen, MS-MVP (Mail) ... Norton Antivirus) I had AVG for a long time and decided to go back to Norton ...
    (microsoft.public.windows.vista.mail)
  • Re: Email programs that work.
    ... multiple accounts since one wouldn't want the same filters to apply to all ... All my home filters only apply to my home mail. ... simple SMTP interface so they can do away with the command line altogether. ... the fact that it passes through an SMTP server prior to the work ...
    (Debian-User)
  • Re: Analysis of an MSN rejection.
    ... and suggest that the sender needs to use their own ISP's SMTP ... >> Mercury SMTP Server: ... > server which accepted the message for relay. ... > and IP addresses are irrelevant in this case; SBC Yahoo! ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)