Extensive, but not functional. The supplied demo will NOT send HTML and an
attachment. It just doesn't work. I've given up on using Indy for HTML email
for now because of this, and was waiting for a fix. There are tons of
unanswered, unacknowledged postings in this newsgroup asking about this.
--
Tim Sullivan
Unlimited Intelligence Limited
Dimethylaminoethanol for your software
http://www.uil.net
Indy 9 is still beta. As for Indy 8, a lot fo them go uanswered because its been answered a billion times and a
quick google search will find the answer.
--
Chad Z. Hower (Kudzu) - http://www.pbe.com/Kudzu/
Current Location: St. Petersburg, Russia
"Programming is an art form that fights back"
IntraWeb - True RAD Development for the web
http://www.pbe.com/IntraWeb
here a fast hack howto scan attachments (only for text/plain text/html) but
binary attachments are handled very similar...
if (SMTPThread[ThreadID].MailDataIN.MessageParts.Items[intIndex] is
TIdText) then
begin
if
pos('html',lowercase(SMTPThread[ThreadID].MailDataIN.MessageParts.Items[intI
ndex].ContentType)) > 0 then
fname := MsgPath+'\0'+IntToStr(intIndex)+'.html'
else fname := MsgPath+'\0'+IntToStr(intIndex)+'.plain';
try
TIdText(SMTPThread[ThreadID].MailDataIN.MessageParts.Items[intIndex]).Body.S
aveToFile(FName);
except
Log('Error saving plain/html');
end;
end;
scan your attachmenst / html / plain for whatever (virus/ ....)
and rebuild your message ( I think your problem is here....)
....
with TIdText.Create(SMTPThread[ThreadID].MailDataIN.MessageParts,
LoadList) do
begin
if MIME = plain then ContentType := 'text/plain'
else ContentType := 'text/html';
end;
except
.....
thats it!!! not really difficult....
Thilo
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs and the Universe producing bigger and
better idiots - so var, the Univers is winnning. -- Rich Cook
"Ebadat A.R." <ARe...@Mabnasoft.com> schrieb im Newsbeitrag
news:3c036d11_1@dnews...
> > The demo extensively shows you how to send plain, html and multi-part
> > emails.
> Extensive, but not functional. The supplied demo will NOT send HTML and an
> attachment. It just doesn't work.
If you're trying to put 'text/html' in the TIdMessage.ContentType, html in
the TIdMessage.Body,
and attachment of some sort, then it it will not work. That is a
multipart message. You need to create TIdText or TIdAttachment instances
for each message part, and set the TIdMessage.ContentType.
'multipart/alternative' if all message parts are TIdText, and
'multipart/related' if a TIdAttachment is involved that has a 'content-id'
header.
> I've given up on using Indy for HTML email
> for now because of this, and was waiting for a fix. There are tons of
> unanswered, unacknowledged postings in this newsgroup asking about this.
I've seen messages on this topic from time to time. Try
http://groups.google.com. There is also an
IndyMailDemo.zip file posted in the attachments group.
hth...
in article <3c047a2f$1_1@dnews>, you wrote:
> There is also an
> IndyMailDemo.zip file posted in the attachments group.
>
but it is missing something called "HTMLLite"
--
Regards
Ralph (TeamB)
==
Use Borland servers; TeamB doesn't see posts via ISPs
http://www.borland.com/newsgroups/genl_faqs.html
==
We do not quit playing because we grow old,
we grow old because we quit playing.
Specifically it didn't work with html email and an attachment. If you can
give me step-by-step instructions to get it to work, I think I might propose
to you. :-)
This is one of the things that Indy should handle automatically, though,
isn't it? If a user creates an HTML message and a file attachment, shouldn't
the component set the whole message to multipart/alternative or
multipart/related based on property settings?
Keep me informed. I'm eager to know what the solution is!
No. You can sent attachments without it having to be multipart/alternative.
It would be multipart/mixed. Set the contetn-type to text/html and then add
attachments. If that doesn't work let me know since it should and somehow
it's broken.
> but it is missing something called "HTMLLite"
Oops. That's some IDE droppings in the uses clause. Just remove it.
in article <3c05418e$1_2@dnews>, you wrote:
> Oops. That's some IDE droppings in the uses clause. Just remove it.
>
Evidently SaveToStream was added to TidMessage in Beta 2. Downloading as we
speak.
I've not tried it in a few weeks, but when I posted my question some time
ago, I had done just that. Give it a shot at your end and let me know if you
manage to get it working. For some reason, at my end, it gets changed back
to text/plain, even though I'd set it correctly.
> Specifically it didn't work with html email and an attachment. If you can
> give me step-by-step instructions to get it to work, I think I might
propose
> to you. :-)
Tim:
Here's a code example that I just used to send an HTML email with a binary
attachment. It contains both a text/plain and a text/html message part. It
does not set the ContentType for the message, just the text message parts.
Indy is handling the content type for the entire message.
hth...
vMsg := TIdMessage.Create(Self);
vMsg.From.Text := EditFrom.Text;
vMsg.Recipients.EMailAddresses := EditTo.Text;
vMsg.Subject := 'This is a multipart/mixed message';
with TIdText.Create(vMsg.MessageParts) do
begin
ContentType := 'text/plain';
Body.Add('Hello World...');
Body.Add('');
Body.Add('Paragraph One.');
Body.Add('');
Body.Add('Paragraph Two.');
Body.Add('Paragraph Three.');
Body.Add('');
end;
with TIdText.Create(vMsg.MessageParts) do
begin
ContentType := 'text/html';
Body.Add('<html>');
Body.Add('<body>');
Body.Add('<h1>Hello World...</h1>');
Body.Add('<p style="color: Red">Paragraph One.</p>');
Body.Add('<p style="color: Green">Paragraph Two.</p>');
Body.Add('<p style="color: Blue">Paragraph Three.</p>');
Body.Add('</body>');
Body.Add('</html>');
end;
with TIdAttachment.Create(vMsg.MessageParts, 'testMail.res') do
ExtraHeaders.Add('content-id=CID:bogus');
with IdSMTP1 do
begin
Host := EditSMTPServer.Text;
try
Connect;
Send(vMsg);
finally
if Connected then Disconnect;
end;
end;
vMsg.Free;
If interested I have a sample.
Regards,
Gregor
Thanks, Don. If this works, you'll have my unending thanks.
Hell, you have my unending thanks anyway! :-)
I would be interested in seeing this example if you could post it in the
attachments board.
TIA.
Fred
"Gregor Ibic" <grego...@intelicom.si> wrote in message
news:3c068d68_1@dnews...
I would be interested in seeing this example if you could post it in the
attachments board.
TIA.
Fred
"Gregor Ibic" <grego...@intelicom.si> wrote in message
news:3c068d68_1@dnews...
Hi,
I have add some code let it support inline img in the html email.
1.May be there have a bug in the TidMessageClient.SendBody
if AMsg.MessageParts.TextPartCount > 0(1) then begin
2.You must add content-id field to the TidAttachment
3.change the Img tag with follow :
Img Src="dddd.gif" to Img Src="cid:img1.ddd"
4.Add the attachments to the message and set the contentid with img1.ddd
Then you can sent it and read it from outlook.
:-)
Neal