Issue with Indy SMTP Client/Engine ?
- From: G. Bradley MacDonald <bradley@xxxxxxxxxxxxxxxxxx>
- Date: Sat, 31 Dec 2005 11:11:16 -0800
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
.
- Follow-Ups:
- Re: Issue with Indy SMTP Client/Engine ?
- From: Liz
- Re: Issue with Indy SMTP Client/Engine ?
- Prev by Date: Re: Christmas version of GExperts with code formatter
- Next by Date: ANN: deAudio is now free!
- Previous by thread: Castalia and D2006
- Next by thread: Re: Issue with Indy SMTP Client/Engine ?
- Index(es):
Relevant Pages
|