girlswants_me
asked on
Using Delphi; Sending text through email.
Hi everyone,
Anybody here knows how to send a text strings from my richedit to this email address
girlswants_me@yahoo.com or to any addressee?
and if anybody can add some special functionality like adding attachments.
I will give an extra points.
Thanks in advance
Anybody here knows how to send a text strings from my richedit to this email address
girlswants_me@yahoo.com or to any addressee?
and if anybody can add some special functionality like adding attachments.
I will give an extra points.
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How will i install this component? I tried to open but it said "Error creating form: Invalid stream format."
and i cannot compile because missing Variants.dcu
and i cannot compile because missing Variants.dcu
ASKER
OK im done installing it. The installation of the component was successful.
can you give me an example codes on how to use your component?
can you give me an example codes on how to use your component?
Here is an example using the Indy components.
This example shows how to create an HTML mail
with an inline, included jpg image.
var
idAttach: TidAttachment;
idText1: TidText;
idText2: TidText;
p: TidMessageParts;
slBody: TStringList;
begin
idMessage1.Recipients.Add;
idMessage1.Recipients[0].A ddress := 'girlswants_me@yahoo.com';
p := idMessage1.MessageParts;
slBody := TstringList.Create;
try
// you can actually load the body from a RichEdit with
// slBody.Text := RichEdit1.LinesText;
slBody.Add('<html>');
slBody.Add('<head>');
slBody.Add('</head>');
slBody.Add('<body>');
slBody.Add('<br /><br /><b><font color="red">Here is the image:</font></b><br /><br /><br />');
slBody.Add('<img src="cid:sm101yellow.jpg" />');
slBody.Add('</body>');
slBody.Add('</html>');
idText1 := TidText.Create(p, slBody);
idText1.ContentType := 'text/html';
idText2 := TidText.Create(p);
idText2.ContentType := 'text/plain';
idText2.Body.Text := '';
// This shows how to add an attachment
idAttach := TidAttachment.Create(p, 'c:\sm101yellow.jpg');
idAttach.ContentType := 'image/jpeg';
idAttach.ContentDispositio n := 'inline';
idAttach.ExtraHeaders.Valu es['conten t-id'] := 'sm101yellow.jpg';
idMessage1.Body.Assign(slB ody);
idAttach.DisplayName := 'sm101yellow.jpg';
idMessage1.ContentType := 'multipart/mixed';
idSMTP1.Connect;
idSMTP1.Send(idMessage1);
finally
idSMTP1.Disconnect;
slBody.Free;
Showmessage('done');
end;
end;
This example shows how to create an HTML mail
with an inline, included jpg image.
var
idAttach: TidAttachment;
idText1: TidText;
idText2: TidText;
p: TidMessageParts;
slBody: TStringList;
begin
idMessage1.Recipients.Add;
idMessage1.Recipients[0].A
p := idMessage1.MessageParts;
slBody := TstringList.Create;
try
// you can actually load the body from a RichEdit with
// slBody.Text := RichEdit1.LinesText;
slBody.Add('<html>');
slBody.Add('<head>');
slBody.Add('</head>');
slBody.Add('<body>');
slBody.Add('<br /><br /><b><font color="red">Here is the image:</font></b><br /><br /><br />');
slBody.Add('<img src="cid:sm101yellow.jpg" />');
slBody.Add('</body>');
slBody.Add('</html>');
idText1 := TidText.Create(p, slBody);
idText1.ContentType := 'text/html';
idText2 := TidText.Create(p);
idText2.ContentType := 'text/plain';
idText2.Body.Text := '';
// This shows how to add an attachment
idAttach := TidAttachment.Create(p, 'c:\sm101yellow.jpg');
idAttach.ContentType := 'image/jpeg';
idAttach.ContentDispositio
idAttach.ExtraHeaders.Valu
idMessage1.Body.Assign(slB
idAttach.DisplayName := 'sm101yellow.jpg';
idMessage1.ContentType := 'multipart/mixed';
idSMTP1.Connect;
idSMTP1.Send(idMessage1);
finally
idSMTP1.Disconnect;
slBody.Free;
Showmessage('done');
end;
end;
ASKER
OK Thank you so much i raised the score to 150
ASKER
OK Thank you so much i raised the score to 150
did that help?
Sorry for the delay girlswants_me....
In the zip file there's a demo too where you can look for a complete example on how to use it.
Let me know if you really used my suggestion or the EddieShipman one, because in this case points should be splitted to him.
F68 ;-)
In the zip file there's a demo too where you can look for a complete example on how to use it.
Let me know if you really used my suggestion or the EddieShipman one, because in this case points should be splitted to him.
F68 ;-)
ASKER