Hi,
I have a RFT file which contains images. I am trying to attach it to an Email and am using the following method
procedure TEmailSenderForm.wpBodyPrepareImageforSaving(
RTFData: TWPRTFDataCollection; Writer: TWPCustomTextWriter;
TextObject: TWPTextObj; var DontSave: Boolean);
var
AGUID : String;
begin
// We clear Source and StreamName to make sure the embedded data is saved to file
TextObject.Source := '';
if TextObject.ObjRef<>nil then
begin
if FWritingHTML then
begin
try
AGUID := TKey.GUID();
TextObject.ObjRef.StreamName := '';
TextObject.ObjRef.FileName := ExtractFileName(TextObject.ObjRef.SaveToFile(Global_SystemConfig.PROP_TEMPFILEPATH, AGUID, ''));
//TextObject.ObjRef.FileName := TextObject.ObjRef.SaveToFile(Global_SystemConfig.PROP_TEMPFILEPATH, AGUID, '');
FMyMail.Attachments.Add(Global_SystemConfig.PROP_TEMPFILEPATH + '\' + TextObject.ObjRef.FileName);
ShowMessage(TextObject.ObjRef.FileName);
Application.ProcessMessages;
except
on E: Exception do
begin
ShowMessage(E.Message);
end;
end;
end;
end;
end;
However, the images are not being displayed in Outlook and the recipient cannot see the images either.
The HTML is below
<html>
<head></head><body>
<table style="padding:0px;margin:0px;width:8.48in;"><tr valign=top style="padding-left:0.01in;padding-right:0.01in;"><td style="text-indent:0.00in;margin-left:0.00in;margin-right:0.00in;border-left-style:solid;border-left-width:1px;border-left-color:black;border-top-style:solid;border-top-width:1px;border-top-color:black;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:black;width:2.01in;"><img src="FC36B6F7-7143-432C-BA73-A9D6A4A471D1.JPG" style="width:1.93in;height:1.44in;"/></td>
<td style="border-top-style:solid;border-top-width:1px;border-top-color:black;border-right-style:solid;border-right-width:1px;border-right-color:black;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:black;width:6.47in;"><b><font face="TheSansOffice">2 bedroom(s) Conversion, Test Property 1 £450 </font><font face="TheSansOffice" color="red"> </font><div> </b></div>
<div><font face="TheSansOffice" size=2 color="black">A bright and spacious two double bedroom flat within a private gated mews style development. The property comprises two double bedrooms, open plan living area with fully fitted kitchen and modern bathroom. Available 8 December. Furnished or Unfurnished. A bright and spacious two double bedroom flat within a private gated mews style development. The property comprises two double bedrooms, open plan living area with fully fitted kitchen and modern bathroom. Available 8 December. Furnished or Unfurnished. </font></div>
</td>
</tr>
</table>
<div> </div>
<table style="padding:0px;margin:0px;width:8.48in;"><tr valign=top style="padding-left:0.01in;padding-right:0.01in;"><td style="text-indent:0.00in;margin-left:0.00in;margin-right:0.00in;border-left-style:solid;border-left-width:1px;border-left-color:black;border-top-style:solid;border-top-width:1px;border-top-color:black;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:black;width:2.01in;"><img src="328BE11D-E1E0-4AB6-9036-C5CD6D423C7C.JPG" style="width:1.93in;height:1.45in;"/></td>
<td style="border-top-style:solid;border-top-width:1px;border-top-color:black;border-right-style:solid;border-right-width:1px;border-right-color:black;border-bottom-style:solid;border-bottom-width:1px;border-bottom-color:black;width:6.47in;"><b><font face="TheSansOffice">2 bedroom(s) Conversion, Test Property 2 £350 </font><font face="TheSansOffice" color="red"> </font><div> </b></div>
<div><font face="TheSansOffice" size=2 color="black">A newly refurbished and very spacious two double bedroom flat with an extra study area/dressing room, reception room, separate kitchen and bathroom. The first floor flat is located close to Newington Green which has excellent bus routes into Angel and the City. Available 19th November. Furnished or Unfurnished. A newly refurbished and very spacious two double bedroom flat with an extra study area/dressing room, reception room, separate kitchen and bathroom. The first floor flat is located close to Newington Green which has excellent bus routes into Angel and the City. Available 19th November. Furnished or Unfurnished. </font></div>
</td>
</tr>
</table>
<div> </div>
<div>Admin</div>
<div>Sales Negotiator</div>
<div> </div>
<div> </div>
<div> </div>
<div>This communication is to be treated as confidential and the information in it may not be used or disclosed except for the purpose for which it has been sent. If you have reason to believe that you are not the intended recipient of this communication, please contact the sender immediately.</div>
</body></html>
Thanks
Rudy