Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: Can I do this with TIdSmtp?

www.cryer.info
Managed Newsgroup Archive

Re: Can I do this with TIdSmtp?

Subject:Re: Can I do this with TIdSmtp?
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Tue, 23 May 2006 10:42:21

"daniel" <danielpan@gd165.com> wrote in message
news:44732add@newsgroups.borland.com...

> But the mail server I use need DATA command like this:
> DATA
> my mail data.
>
> .
> It is to say, the '.' need a blank line before it, and after it.

The blank line before the '.' is not required by SMTP.  The only requirement
is that the '.' be on a line by itself.  If your server requires a blank
line before the '.' then the server is not compliant with the SMTP rules and
needs to be fixed.  A lot of SMTP-enabled clients do not include a blank
line before the '.'.

> But I found my mail with TIdSmtp's DATA command like this:
> DATA
> my mail data.
> .

As it should be.  That is the correct thing to do, under the SMTP rules.

> The mail I sent with TIdSmtp does not have a blank line before the '.'

It is not supposed to.

> so the mail server does not response the DATA command.

The server is wrong.  In fact, the server is not supposed to care about
blank lines at all.  As soon as the server receives the DATA command and
responds to it, it is required by the rules ofSMTP to keep EVERYTHING until
the ending '.' is encountered.  Everything between the DATA command and the
ending '.' has to be sent to the recipient(s) as-is, blank lines and all.
If your server is not doing that, then the server is buggy and needs to be
fixed.

> Can I insert a blank line before the '.' with TIdSmtp?

The only way to do that is to place an extra blank line at the end of your
message data in the TIdMessage.  However, that will only work if your data
is being stored in the TIdMessage.Body property, and you have no other
pieces in the TIdMessage.MessageParts collection.  As soon as you use the
MessageParts collection, you lose control over the format of the data that
TIdMessage generates to wrap the pieces in an email-friendly manner.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive