Hi Dod I understand this bit (I think):-
> but an image in a mail is a BASE64 encoded attachement so if you > convert HTMLToString then you'll only get the HTML text part of your mail, not the attached binary files like > images. But here, I'm not with you > To do this you may have to decode attached picture into its orignal non BASE64 > fomrmat then load it into you RichEdit. ... Because I have already loaded the image (Code below). The effect I'm trying to get is exactly like (say) MS Outlook where, in HTML format mails, you can enter formatted text and past images e.g. a screen shot. I can get that far with what I have written, except that the image gets stripped on the way out. I DON'T want to have the image sent as an attachment (can already do that) but want it in the body of the email itself. Cheers Jeff ============================ This is how the image gets into the richedit:- i := 0; while i >= 0 do begin i := BodyText.FindText('{Other|Photo}', 0, MaxInt, []); if i >= 0 then begin BodyText.SelStart := i; BodyText.SelLength := 13; with Common.dlgOpenPicture do begin InitialDir := Common.GetPreference('Photo Location'); if Execute then begin Pict := TPicture.Create; try Pict.LoadFromFile(FileName); BodyText.InsertGraphic(Pict.Graphic, True); finally Pict.Free; end; end else break; end; end; end; ============================ JC> Hi JC> Currently I have a program that works 99% OK ;-) JC> I compose a rich text email in JC> BodyText: TJvRichEdit; JC> and I send it with code like this:- JC> if BodyText.PlainText then sl.Text := BodyText.Text JC> else Common.JvRichEditToHtml.ConvertToHtmlStrings(BodyText, JC> sl); JC> where sl is a TStringList. JC> Then (code that was straight out of an example) :- JC> procedure TSMTPMailMsgForm.SmtpClientGetData(Sender: TObject; JC> LineNum: Integer; MsgLine: Pointer; MaxLen: Integer; var More: JC> Boolean); var JC> Len: Integer; JC> begin JC> if LineNum > sl.Count then JC> More := FALSE JC> else begin JC> Len := Length(sl.Strings[LineNum - 1]); JC> { Truncate the line if too long (should wrap to next line) } JC> if Len >= MaxLen then JC> StrPCopy(MsgLine, Copy(sl.Strings[LineNum - 1], 1, MaxLen - 1)) JC> else JC> StrPCopy(MsgLine, sl.Strings[LineNum - 1]); JC> end; JC> end; JC> Now this works and we get nicely formatted emails sent out. EXCEPT JC> when the user puts an Image into the BodyText (TJvRichEdit). JC> In this case the image is simply dropped. JC> I'm hoping that there is a simple solution that doesn't involve JC> rewriting too much ! JC> -- JC> Jeff Cook JC> "The Cooks" Oasis JC> The Cooks Ltd JC> Phone: +682 28 213 JC> Skype: jeffraro JC> www.cookislandsoasis.com <http://www.cookislandsoasis.com/> JC> <http://fta.firetrust.com/index.cgi?id=jeffraro&page=1&campaign= aspect_email>> I use and recommend MailWasher Pro to keep my mailbox JC> clear of SPAM -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be