sending email containing rtf or html

Is it possible to send an email which contains rtf or html text? So far I know it's not possible with the fastnet components delivered with D5.

Thanks for your help.
bussoftwareAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
listening
0
TheNeilCommented:
The NMSMTP component that ships with Delphi is simply not up to the job as it's 'body' is merely a stringlist. If you want to go down this route (which I don't think you do but I'm not going to spoil my brief second of greatness) then you could send your RTF/HTML as an attachment. I bet this isn't what you want to do though is it?

The Neil
0
bussoftwareAuthor Commented:
Neil, you are right. The thought with the attachement I had before I asked this question. But is there nocomponent available, which is able to send rtf-bodies?

Olaf
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

TheNeilCommented:
Olaf,

There isn't a component that I know of but I don't claim to be an expert on 3rd party components so maybe a look at Torry's web page might help? (Sorry, I don't know the address off the top of my head but a quick search on www.AltaVista.com should sort you out).

The Neil
0
333Commented:
hi,
there is one way to do such thing with fastnet comps. i'm not sure if it works with D5, but it works with my D4.
if you look at message header (which you have send using TNMSMTP) i.e. in netscape messenger, you will see field 'Content-Type: text/plain; charset=us-ascii'. that's the point. you need to change this to text/html.
TNMSMTP has property SubType which i think doesn't work or is for something different, because nothing changes in message header when you change this property. however there is property FinalHeader, which is filled just before sending the message. it is filled when you call SendMail, but you can change it in OnSendStart event.

procedure TForm1.NMSMTP1.SendStart(Sender: TObject);
var
  i:integer;
begin
  for i:=0 to NMSMTP1.FinalHeader.Count-1 do
    if pos('Content-Type',NMSMTP1.FinalHeader[i])>0 then
      NMSMTP1.FinalHeader[i]:='Content-Type: text/html; charset=us-ascii';
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  NMSMTP1.connect;
  NMSMTP1.sendmail;
  NMSMTP1.disconnect;
end;

just fill all other fields with info you need and place in message body html code.

for rtf mail i think there should be 'Content-Type: text/rtf; charset=us-ascii'

A.
0
kotikCommented:
Hi,
I use for that the Mail2000 components.
You can find it at Torry pages: http://www.torry.ru
(Unfortunately I don't remember the exact address where I find them)
Using them you can send either HTML or RTF bodies.

Regards,
Kot
0
bryan7Commented:
listenning
0
bryan7Commented:
listenning
0
bussoftwareAuthor Commented:
To A.

I think this is the right way. But I still have one problem. I don't use the TNMSMTP Component on a form, but create it myself with SMTP1 := TNMSMTP.Create(Application). Do you know how to write the eventhandler "OnSendStart" in this case?

Thanks for your help.

Olaf
0
333Commented:
it's simple:

after
SMTP1 := TNMSMTP.Create(Application);
write
SMTP1.OnSendStart:=MySendStart;
where MySendStart is method of any object you have. i.e if you have TForm, you can do so:

type
  TForm1 = class(TForm)
  ...
  procedure MySendStart(Sender: TObject);
  ...
  end;

if you create everything at runtime, you can make a descendant from TNMSMTP:

type
  TSMTP = class(TNMSMTP)
     constructor Create(AOwner:TComponent); override;
     procedure MySendStart(Sender: TObject);
  end;

constructor Create(AOwner:TComponent);
begin
  inherited Create(AOwner);
  OnSendStart:=MySendStart;
end;

procedure TSMTP.MySendStart(Sender: TObject);
begin
   {anything you need}
end;

A.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bussoftwareAuthor Commented:
Thanks a lot.
0
bussoftwareAuthor Commented:
Hello A.

html is ok, rtf doesn't work. I used MS Outlook and Outlook Express. However, this shouldn't be the point. I think that the email programs aren't able to show rtf-format.

greetings, Olaf
0
333Commented:
maybe you're right.
i have never received a rtf email, so i can't check it.
i'm using nescape which i think can't display rtf.
if you have also client, which can send/show rtf email, i suggest you to look at message header. maybe content-type should be something other.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.