Re: IDSMTP - problems sending email

Giganews Newsgroups
Subject: Re: IDSMTP - problems sending email
Posted by:  Remy Lebeau \(Indy Team\) (
Date: Wed, 22 Apr 2009

"Mark Williams" <mark@{removethis}> wrote in message

> I am having various problems sending smtp emails. I have posted
> my code below.

Which build of Indy 10 are you using?  And do you have the
TIdSMTP.Pipelining property set to True or False?

> 1 If there are any attachments then I get an smtp error 354 "OK Send data
> with <CRLF>.<CRLF>"

That suggests the server's reply to the DATA command is not being processed
correctly.  Which line in your code is raising the 354 error?

> If there are no attachments I do not get this error.

Is a separate exception being raised by Indy internally when attachments are
present?  What does the debugger say is actually happening?

> However, I am setting the body of the email from a richedit and
> only the last line gets added to the body text.

Then you are not adding the RichEdit text to the TIdMessage correctly.

> I am using an older indy 10 snapshot (which may be the cause of the
> issue but I cannot install the latest snapshot

Why not?

>  TextPart := TIdText.Create(IDMessage1.MessageParts, nil);
>  TextPart.ContentType := 'multipart/alternative';
>  TextPart.ParentPart := -1;

Given the code you have shown, you should not be adding that
'multipart/alternative' text part to the message at all, since you are only
putting plain text into the message and no other representations, such as
HTML or RTF.  Get rid of it.

Remy Lebeau (TeamB)


In response to

IDSMTP - problems sending email posted by Mark Williams on Wed, 22 Apr 2009