Board index » delphi » Indy: HTML plus attachment - demo?

Indy: HTML plus attachment - demo?

I have read all the newsgroup archives, and can't seem to find a way to send
an HTML email with attachments. I've tried using the demos that comes with
Indy, and they don't handle text/html text parts correctly.

Basically, I get an email that has the content of "This is a multi-part
message in MIME format" and the attachment, but not the text/html text part
that I created.

Is there some tested code that has an HTML email with an attachment that I
could see?

Thanks in advance,

--
Tim Sullivan
Unlimited Intelligence Limited
Dimethylaminoethanol for your software
http://www.uil.net

 

Re:Indy: HTML plus attachment - demo?


Quote
"Tim Sullivan" <t...@NO.SPAM.FOR.ME.uil.net> wrote in message

news:3bc45d54$1_2@dnews...

Quote
> I have read all the newsgroup archives, and can't seem to find a way to
send
> an HTML email with attachments. I've tried using the demos that comes with
> Indy, and they don't handle text/html text parts correctly.

> Basically, I get an email that has the content of "This is a multi-part
> message in MIME format" and the attachment, but not the text/html text
part
> that I created.

> Is there some tested code that has an HTML email with an attachment that I
> could see?

Tim, Since you've been asking this question for many times in many different
forms now, and no one has replied to it yet, i think it's safe to assume
that no-one either did it, or that no one is willing to tell you how to make
spam.
So your best bet is simply to experiment with what you have. Have a look at
the code you have, look up some RFC documents that perhaps can shed some
light on it, and try it.

Re:Indy: HTML plus attachment - demo?


Quote
> Tim, Since you've been asking this question for many times in many
different
> forms now, and no one has replied to it yet, i think it's safe to assume
> that no-one either did it, or that no one is willing to tell you how to
make
> spam.

1) This is the first time I've asked this questions, and never in any other
forum. Perhaps you're confusing me with someone else.

2) Who the hell are you to accuse me of "wanting to make spam"? My clients
want to be able to email out resumes to potential employers as PDF files
using HTML email, so they can have their letterhead in the email. They ask,
I respond. Don't be such a jerk - you don't know anything about a) me; or b)
my clients.

Quote
> So your best bet is simply to experiment with what you have. Have a look
at
> the code you have, look up some RFC documents that perhaps can shed some
> light on it, and try it.

You say this like I've not already. I've spent almost 12 hours trying to get
this to work. I was hoping that perhaps someone who is on the Indy team
might be able to shed some light, since the question comes up often. This
isn't something I should have to debug, specifically. It doesn't work as
advertised, and I want to know if I'm just doing it wrong or if it's
actually a flaw in Indy.

--
Tim Sullivan
Unlimited Intelligence Limited
Dimethylaminoethanol for your software
http://www.uil.net

Re:Indy: HTML plus attachment - demo?


On the same quest at the mo, I have used the folowing code in order to get
this to almost work, and I need to change one property and it will work.

At the mo I do the following.

msgEmail.Body.text := '<HTML>' etc.
TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
msgEmail.Body.text := 'Text Part' etc.
TIdText.Create(msgEmail.Messageparts,msgEmail.Body);

And then obviously I have the attachments using the same method,

TIdAttachment.Create(msgEmail.Messageparts, 'C:\Config,sys');

The one little thing that is stopping it from working now is that I need to
set the content type of
TIdText.Create(msgEmail.Messageparts,msgEmail.Body); to html. then all the
code will work.

And at the mo trying to determine when the email content type should be
multipart/alternative or multipart/related, I will check out the RFC and see
if I can desypher this from the documents.

Inferno

Quote
"Tim Sullivan" <t...@NO.SPAM.FOR.ME.uil.net> wrote in message

news:3bc470a1_2@dnews...
Quote
> > Tim, Since you've been asking this question for many times in many
> different
> > forms now, and no one has replied to it yet, i think it's safe to assume
> > that no-one either did it, or that no one is willing to tell you how to
> make
> > spam.

> 1) This is the first time I've asked this questions, and never in any
other
> forum. Perhaps you're confusing me with someone else.

> 2) Who the hell are you to accuse me of "wanting to make spam"? My clients
> want to be able to email out resumes to potential employers as PDF files
> using HTML email, so they can have their letterhead in the email. They
ask,
> I respond. Don't be such a jerk - you don't know anything about a) me; or
b)
> my clients.

> > So your best bet is simply to experiment with what you have. Have a look
> at
> > the code you have, look up some RFC documents that perhaps can shed some
> > light on it, and try it.

> You say this like I've not already. I've spent almost 12 hours trying to
get
> this to work. I was hoping that perhaps someone who is on the Indy team
> might be able to shed some light, since the question comes up often. This
> isn't something I should have to debug, specifically. It doesn't work as
> advertised, and I want to know if I'm just doing it wrong or if it's
> actually a flaw in Indy.

> --
> Tim Sullivan
> Unlimited Intelligence Limited
> Dimethylaminoethanol for your software
> http://www.uil.net

Re:Indy: HTML plus attachment - demo?


There we go done some more messing around all working.

create a variable
  sMessage: TIdText;

Then

  msgEmail.ContentType := 'Multipart/Alternative';

  // Add HTML to email.
  msgEmail.Body.Text := '<HTML>'; etc.
  sMessage := TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
  sMessage.ContentType := 'text/html';

  // Add Text to email.
  msgEmail.Body.Text := 'Some Text'; etc.
  sMessage := TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
  sMessage.ContentType := 'text/plain';

  // Add Attachmtents
  TidAttachment.Create(msgEmail.Messageparts,'C:\Test.Doc');

And that should be it send that through, it displays in outlook fine for me
and my proggie., now work what type of multipart it is.

Inferno

Quote
"Lee Bambury" <Lee.Bamb...@Jalco.co.uk> wrote in message

news:3bc57aec_1@dnews...
Quote
> On the same quest at the mo, I have used the folowing code in order to get
> this to almost work, and I need to change one property and it will work.

> At the mo I do the following.

> msgEmail.Body.text := '<HTML>' etc.
> TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
> msgEmail.Body.text := 'Text Part' etc.
> TIdText.Create(msgEmail.Messageparts,msgEmail.Body);

> And then obviously I have the attachments using the same method,

> TIdAttachment.Create(msgEmail.Messageparts, 'C:\Config,sys');

> The one little thing that is stopping it from working now is that I need
to
> set the content type of
> TIdText.Create(msgEmail.Messageparts,msgEmail.Body); to html. then all the
> code will work.

> And at the mo trying to determine when the email content type should be
> multipart/alternative or multipart/related, I will check out the RFC and
see
> if I can desypher this from the documents.

> Inferno

> "Tim Sullivan" <t...@NO.SPAM.FOR.ME.uil.net> wrote in message
> news:3bc470a1_2@dnews...
> > > Tim, Since you've been asking this question for many times in many
> > different
> > > forms now, and no one has replied to it yet, i think it's safe to
assume
> > > that no-one either did it, or that no one is willing to tell you how
to
> > make
> > > spam.

> > 1) This is the first time I've asked this questions, and never in any
> other
> > forum. Perhaps you're confusing me with someone else.

> > 2) Who the hell are you to accuse me of "wanting to make spam"? My
clients
> > want to be able to email out resumes to potential employers as PDF files
> > using HTML email, so they can have their letterhead in the email. They
> ask,
> > I respond. Don't be such a jerk - you don't know anything about a) me;
or
> b)
> > my clients.

> > > So your best bet is simply to experiment with what you have. Have a
look
> > at
> > > the code you have, look up some RFC documents that perhaps can shed
some
> > > light on it, and try it.

> > You say this like I've not already. I've spent almost 12 hours trying to
> get
> > this to work. I was hoping that perhaps someone who is on the Indy team
> > might be able to shed some light, since the question comes up often.
This
> > isn't something I should have to debug, specifically. It doesn't work as
> > advertised, and I want to know if I'm just doing it wrong or if it's
> > actually a flaw in Indy.

> > --
> > Tim Sullivan
> > Unlimited Intelligence Limited
> > Dimethylaminoethanol for your software
> > http://www.uil.net

Re:Indy: HTML plus attachment - demo?


Quote
"Tim Sullivan" <t...@NO.SPAM.FOR.ME.uil.net> wrote in message

news:3bc470a1_2@dnews...

Quote
> > Tim, Since you've been asking this question for many times in many
> different
> > forms now, and no one has replied to it yet, i think it's safe to assume
> > that no-one either did it, or that no one is willing to tell you how to
> make
> > spam.
> 1) This is the first time I've asked this questions, and never in any
other
> forum. Perhaps you're confusing me with someone else.

I am, i've seen this question at least 4 times.

Quote
> 2) Who the hell are you to accuse me of "wanting to make spam"? My clients
> want to be able to email out resumes to potential employers as PDF files
> using HTML email, so they can have their letterhead in the email. They
ask,
> I respond. Don't be such a jerk - you don't know anything about a) me; or
b)
> my clients.

I'm not saying that. All i was saying that 'no one' wanted to show how it's
done.
A and B both guilty as charged.

Quote
> > So your best bet is simply to experiment with what you have. Have a look
> at
> > the code you have, look up some RFC documents that perhaps can shed some
> > light on it, and try it.

> You say this like I've not already. I've spent almost 12 hours trying to
get
> this to work. I was hoping that perhaps someone who is on the Indy team
> might be able to shed some light, since the question comes up often. This
> isn't something I should have to debug, specifically. It doesn't work as
> advertised, and I want to know if I'm just doing it wrong or if it's
> actually a flaw in Indy.

Hmm, ok, if you want us to let you know if that what you do is wrong,
perhaps you can show some code that you have so far and from that we can
perhaps point out problem areas..
Since you didn't give any information on what you already found out and what
you already tried, how can you expect someone else to give you an answer
that either confirms your thoughts or point out a 'flaw' in what you do.

Re:Indy: HTML plus attachment - demo?


Lee,

Are you using Indy 8 or 9 (beta).  I'm interested in getting this working
also.  Is it the order in which you're setting properties that makes the
difference?  If I set the content-type to "text/html" everything works fine,
as long as I don't specify an attachment.  As soon as I specify an attachment
the content-type is set back to "text/plain".  I'm using Indy 8.

Thanks for any help you can provide.
Andy Blanchard

Quote
"Lee Bambury" <Lee.Bamb...@Jalco.co.uk> wrote in message

news:3bc58252_1@dnews...
Quote
> There we go done some more messing around all working.

> create a variable
>   sMessage: TIdText;

> Then

>   msgEmail.ContentType := 'Multipart/Alternative';

>   // Add HTML to email.
>   msgEmail.Body.Text := '<HTML>'; etc.
>   sMessage := TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
>   sMessage.ContentType := 'text/html';

>   // Add Text to email.
>   msgEmail.Body.Text := 'Some Text'; etc.
>   sMessage := TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
>   sMessage.ContentType := 'text/plain';

>   // Add Attachmtents
>   TidAttachment.Create(msgEmail.Messageparts,'C:\Test.Doc');

> And that should be it send that through, it displays in outlook fine for me
> and my proggie., now work what type of multipart it is.

> Inferno

> "Lee Bambury" <Lee.Bamb...@Jalco.co.uk> wrote in message
> news:3bc57aec_1@dnews...
> > On the same quest at the mo, I have used the folowing code in order to get
> > this to almost work, and I need to change one property and it will work.

> > At the mo I do the following.

> > msgEmail.Body.text := '<HTML>' etc.
> > TIdText.Create(msgEmail.Messageparts,msgEmail.Body);
> > msgEmail.Body.text := 'Text Part' etc.
> > TIdText.Create(msgEmail.Messageparts,msgEmail.Body);

> > And then obviously I have the attachments using the same method,

> > TIdAttachment.Create(msgEmail.Messageparts, 'C:\Config,sys');

> > The one little thing that is stopping it from working now is that I need
> to
> > set the content type of
> > TIdText.Create(msgEmail.Messageparts,msgEmail.Body); to html. then all the
> > code will work.

> > And at the mo trying to determine when the email content type should be
> > multipart/alternative or multipart/related, I will check out the RFC and
> see
> > if I can desypher this from the documents.

> > Inferno

> > "Tim Sullivan" <t...@NO.SPAM.FOR.ME.uil.net> wrote in message
> > news:3bc470a1_2@dnews...
> > > > Tim, Since you've been asking this question for many times in many
> > > different
> > > > forms now, and no one has replied to it yet, i think it's safe to
> assume
> > > > that no-one either did it, or that no one is willing to tell you how
> to
> > > make
> > > > spam.

> > > 1) This is the first time I've asked this questions, and never in any
> > other
> > > forum. Perhaps you're confusing me with someone else.

> > > 2) Who the hell are you to accuse me of "wanting to make spam"? My
> clients
> > > want to be able to email out resumes to potential employers as PDF files
> > > using HTML email, so they can have their letterhead in the email. They
> > ask,
> > > I respond. Don't be such a jerk - you don't know anything about a) me;
> or
> > b)
> > > my clients.

> > > > So your best bet is simply to experiment with what you have. Have a
> look
> > > at
> > > > the code you have, look up some RFC documents that perhaps can shed
> some
> > > > light on it, and try it.

> > > You say this like I've not already. I've spent almost 12 hours trying to
> > get
> > > this to work. I was hoping that perhaps someone who is on the Indy team
> > > might be able to shed some light, since the question comes up often.
> This
> > > isn't something I should have to debug, specifically. It doesn't work as
> > > advertised, and I want to know if I'm just doing it wrong or if it's
> > > actually a flaw in Indy.

> > > --
> > > Tim Sullivan
> > > Unlimited Intelligence Limited
> > > Dimethylaminoethanol for your software
> > > http://www.uil.net

Other Threads