Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Mar : HTML and Indy 9 Part 2
| Subject: | HTML and Indy 9 Part 2 |
| Posted by: | "Claude" (livrepl..@magic.fr) |
| Date: | Fri, 23 Mar 2007 11:10:05 |
well
I made a project only for that.
It is still the same: the procedure TIdText don't work.
Below the complete source
I use D7 one componet IdSMTP1 and IdMessage1+ a memo call statusmemo
Confirguration: I did'nt change anything on the component side.
procedure TForm1.Button1Click(Sender: TObject);
begin
//setup SMTP
IdSMTP1.Host := 'smtp.magic.fr';
IdSMTP1.Port := 25;
//setup mail message
IdMessage1.From.Address := 'Mickey@MickeyMouse.com';
IdMessage1.Recipients.EMailAddresses :='livreplus@magic.fr';
IdMessage1.Subject :='Test Mailing3';
// obviouly, the HTML text is just few lines to test. but I think I should
get the head and below the few line
// I get a dot line on the top and the image of my letter head below.
// When I take out the attachment part, I get a blank window
With TIdtext.Create(idMessage1.MessageParts,nil) do
begin
Body.Text:= '<HTML><HEAD><META NAME="GENERATOR" CONTENT="Adobe PageMill 3.0
Win">'+
'<TITLE>Document sans titre</TITLE></HEAD><BODY BGCOLOR="#ffffff">'+
'<!--SELECTION--><IMG SRC="cid:TeteLettre.jpg" WIDTH="709" HEIGHT="116"'+
'ALIGN="BOTTOM" BORDER="0" NATURALSIZEFLAG="0"><P> </P>'+
'<P><B>Approvisionnement en fournitures et livres scolaires pour'+
'la rentrée scolaire 2007/2008</B></P></BODY></HTML>';
ContentType:='text/html';
end;
With TIdAttachment.Create(IdMessage1.MessageParts,
'c:\MailingApplication\TexteMessage\TeteLettre.jpg') do
Begin
Headers.Values['Content-ID'] := 'TeteLettre.jpg';
ContentType:='Image/jpeg';
FileName:='TeteLettre.jpg';
end;
IdMessage1.ContentType:='multipart/related;type="text/html"';
try
try
IdSMTP1.Connect(10000);
IdSMTP1.Send(IdMessage1);
except on E:Exception do
StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
end;
finally
if IdSMTP1.Connected then IdSMTP1.Disconnect;
end;
end;
procedure TForm1.IdSMTP1Status(ASender: TObject; const AStatus: TIdStatus;
const AStatusText: String);
begin
StatusMemo.Lines.Insert(0,'Status: ' + AStatusText);
end;
end.
I cannot tell you more. Like I said I read and reread your article, try
every configuration, in all maner but I have always the SAME probleme
The procedure Tidtext don't seem to work!
Regards
claude