locked
Modifying documents for emailing using CDO.Message RRS feed

  • Question

  • I am using CDO.Message to create and send email. The email is a word document saved as an .htm file. I would like to modify the email to include the .htm document and data from a memo field (NOT as an attachment) in the body of the email. How?
    Wednesday, January 4, 2012 5:01 PM

Answers

  • I've seen a post saying "CDO does not support two bodies" somewhere. But it should be easy to test it.

    To include memo HTML into existing HTML document should be easy if you place some marker text string into the Word document and then replace this string in htm by memo using STRTRAN function.

     

    • Proposed as answer by Mike Feng Monday, January 9, 2012 10:34 AM
    • Marked as answer by Mike Feng Friday, January 13, 2012 3:46 PM
    Wednesday, January 4, 2012 7:46 PM
  • What documentation of CreateMHTMLBody says:

    The CreateMHTMLBody method converts the contents of an entire Web page into a MIME Encapsulation of Aggregate HTML Documents (MHTML) formatted message body.

    That indirectly means no other involvement into the body, after CreateMHTMLBody.

    If you want to change the body you need to do that previously to creating the mhtml body. And Textmerge into HTML source text with some markers/&placeholders for the data to go in at that  position is the best way to handle this.

    Bye, Olaf.

    • Proposed as answer by Mike Feng Monday, January 9, 2012 10:34 AM
    • Marked as answer by Mike Feng Friday, January 13, 2012 3:46 PM
    Friday, January 6, 2012 4:13 PM

All replies

  • To create HTML body should be easy: http://fox.wikis.com/wc.dll?Wiki~CdoEmail
    Wednesday, January 4, 2012 5:20 PM
  • Pavel, I believe you have misunderstood the question. I am using CreateHTMLBody to bring in the .htm document. In addition, I want to include data from a memo field as part of the email body.

    Thanks for your response though.

    Wednesday, January 4, 2012 6:15 PM
  • Then you have to convert memo data into a HTML and include it into the HTML body. You may use e.g. following code sample to get ideas how to do it: http://www.alvechurchdata.co.uk/company/foxhtml.html, http://www.alvechurchdata.co.uk/company/foxmerge.html 

    Another resources: http://fox.wikis.com/wc.dll?Wiki~HtmlEncode

    You may also update the Word document via automation and then to save it as HTML. More info: http://www.hentzenwerke.com/catalog/autofox.htm

    Wednesday, January 4, 2012 6:31 PM
  • Thanks Pavel. I assumed just what you said (i.e., converting the memo data into HTML) and then incorporating it into the existing document. By the way, the existing document is an .htm document so I will have to manipulate it some.

    Is it possible to use CreateMHTMLBody and Textbody in sequence? I misswrote previously when I said CreateHTMLBody.

    Wednesday, January 4, 2012 7:30 PM
  • I've seen a post saying "CDO does not support two bodies" somewhere. But it should be easy to test it.

    To include memo HTML into existing HTML document should be easy if you place some marker text string into the Word document and then replace this string in htm by memo using STRTRAN function.

     

    • Proposed as answer by Mike Feng Monday, January 9, 2012 10:34 AM
    • Marked as answer by Mike Feng Friday, January 13, 2012 3:46 PM
    Wednesday, January 4, 2012 7:46 PM
  • CDO definitely does not support two bodies. Can you provide an example of a possible solution please?
    Wednesday, January 4, 2012 11:03 PM
  • Hi Pavel,

    Do you have any updates?

    Have a nice day.


    Call me ghost for short, Thanks
    To get the better anwser, it should be a better question.
    Friday, January 6, 2012 9:59 AM
  • Hi Pavel,

    Do you have any updates?

    And what was your question?

    If you are interested in a complete solution to Cochise_kg's requirement then I have no such solution by hand and have no plans to create it at the moment.

    Friday, January 6, 2012 3:12 PM
  • What documentation of CreateMHTMLBody says:

    The CreateMHTMLBody method converts the contents of an entire Web page into a MIME Encapsulation of Aggregate HTML Documents (MHTML) formatted message body.

    That indirectly means no other involvement into the body, after CreateMHTMLBody.

    If you want to change the body you need to do that previously to creating the mhtml body. And Textmerge into HTML source text with some markers/&placeholders for the data to go in at that  position is the best way to handle this.

    Bye, Olaf.

    • Proposed as answer by Mike Feng Monday, January 9, 2012 10:34 AM
    • Marked as answer by Mike Feng Friday, January 13, 2012 3:46 PM
    Friday, January 6, 2012 4:13 PM