?
Solved

Can someone tell me how to send an html email?

Posted on 2004-04-08
3
Medium Priority
?
528 Views
Last Modified: 2010-04-05
Can someone give me an example of how to send html messages with idSMTP ? (multi part message)
0
Comment
Question by:pucko
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Ivanov_G earned 500 total points
ID: 10782965
Var
  IdSMTP1: TIdSMTP;
  IdMessage1: TIdMessage;
  i:integer;
  idText1: TidText;
  idText2: TidText;
  p: TidMessageParts;
  MyBody:TStrings;
Begin
  IdMessage1:=TIdMessage.Create(nil);
  IdSMTP1:=TIdSMTP.Create(nil);

  p := idMessage1.MessageParts;
  MyBody:=TStringlist.create;
  MyBody.Add('<b>Our message </b>');
  idText1 := TidText.Create(p, MyBody);
  idText1.ContentType := 'text/html';  
  idText2 := TidText.Create(p);
  idText2.ContentType := 'text/plain';
  idText2.Body.Text := 'Body Text';
 
  With IdMessage1 do
    Begin
      CharSet:='iso-8859-1';
      Encoding:=meMIME;
      ContentType:= 'multipart/mixed';  
      From.Text:='me@mydomain.com';
      Recipients.EMailAddresses:='to@yourdomain.com';
      Subject:='My subject';
      TIdAttachment.Create(IdMessage1.MessageParts,'tralala.pdf');
    End;
  IdSMTP1.Host:='mail.mydomain.com';  
  IdSMTP1.Connect(300);

  try
    IdSMTP1.send(IdMessage1);
  finally
    IdSMTP1.Disconnect;
  End;
  IdMessage1.Free;
  IdSMTP1.Free;
End;
0
 
LVL 1

Author Comment

by:pucko
ID: 10783674
In which unit do I find the TIdMessage;
0
 
LVL 12

Expert Comment

by:Ivanov_G
ID: 10784252

  unit IdMessage;

  on my machine it is in C:\Program Files\Borland\Delphi5\Indy\Source\ folder
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month9 days, 17 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question