Creating eml email with WPTools

  • Hi
    I use TMailServer to create emails.

    Is there a way to compose an email with WPtools with a mixture of images and text and to then send this as an eml mail i.e. like outlook express with the images embeded in a single email

    Regards

    Bobby

    • Offizieller Beitrag

    Hi,

    You need a temporary directory for this.

    There you save the text in HTML format.

    You need to use the OnPrepareImageForSaving event to create a image file for each embedded image.

    Then you can use your internet library to attach all files.

    In the following demo I also added code to create a PDF version of the mail.

    I hope this helps,

    Julian

  • Hi Julian

    Is there a way to force the font declaration into the HTML file saved with wpRichText.AsANSIStr(HTML)

    If I have a font set as a default in the editor and only type a few words and then use the above to get the HTML for this then the font is not included in the HTML

    Regards

    Bobby

  • hi Julian

    I use the following code in the form.create

    wpWordProc.DefaultAttr.SetFontName('Arial');
    wpWordProc.DefaultAttr.SetFontSize(10);

    Can I force the wpWordProc.Text.AsAnsiStr(HTML) method to add the default font setting to the HTML created?

    Regards
    Bobby

    • Offizieller Beitrag

    If you use -writebasefont in the format string the HTML
    reader will save the BASEFONT tag.

    Code
    //WOIOHTML.PAS
      if OptWriteBaseFont or (soWriteBasefontTag in FHTMLStoreOptions) then
      begin
        WriteString('<basefont face="');
        WriteString(FRTFDataCollection.DefaultFont.Name);
        WriteString('"/>');
      end;

    I assume this is what you need.