/ Forums / Advansys Formativ / Formativ Creator / HTML emails not displaying correctly on forward or reply

  • Creator
    Topic
  • #3605
    MikeC
    Participant

    Hi Team,

    I am wondering if you can point me in the right direction. The following code is an example of the code I use to send out a newsletter to many recipients.
    The mail send out without any problems and looks quite neat. However if the recipient tries to reply to the email or forward it on to another recipient, the HTML code is shown in the body of the email, not the HTML view.

    Code Example:
    dim newMail
    dim srlText
    dim mailTo
    dim subject

    Set srlText = Utilities.StringList
    Set newMail = GroupWise.Account.MailBox.Messages.Add(“GW.MESSAGE.MAIL”)

    srlText.Add(“<HTML><BODY>” + vbCrLf)
    srlText.Add(“<FONT TYPE=” + chr(34) + “VEDANA ” + chr(34) + “SIZE=” + chr(34) + “3” + chr(34) + “>”)
    srlText.Add(“<BR> This is a link to “)
    srlText.Add(“<A HREF=” + chr(34) + “http://www.advansyscorp.com/forums/forum/3634089931-2/&#8221;)
    srlText.Add(chr(34) + “>Formativ Forums</A> <BR>”)
    srlText.Add(vbCrLf + “</FONT></BODY></HTML>”)
    subject = “Formativ Forum Support”
    mailTo = emailaddress

    newMail.Recipients.Add mailTo, , 0
    newMail.Subject = subject
    newMail.BodyText = srlText.Text
    newMail.Send

    srlText.Clear
    End Exmaple

    Am I doing this the wrong way? I could not find anything in the Object API to describe a different way of creating HTML viewed emails.

    HTML emails I have received from other sources forward on correctly, I wish mine to do the same.

    Thanks in advance for any help.
    Mike

  • Author
    Replies
  • #5589
    Support 3
    Participant

    Object API does not expose any method to create the HTML message easily. We have been asking Novell to add method to create HTML message and finally GroupWise 8 may have this method.

    In the meantime, you have to create the TEXT.htm file and add as an attachment to create the proper HTML message. The following code save the HTML contents to TEXT.htm file and add as an attachment to the message. Another modification to your code, we recommend to create the draft message in Work-In-Progress folder rather then the mailbox.

      
      dim newMail
      dim srlText
      dim mailTo
      dim subject
    
      Set srlText = Utilities.StringList
      Set newMail = GroupWise.Account.workfolder.Messages.Add("GW.MESSAGE.MAIL")
    
      srlText.Add("<HTML><BODY>" + vbCrLf)
      srlText.Add("<FONT TYPE=" + chr(34) + "VEDANA " + chr(34) + "SIZE=" + chr(34) + "3" + chr(34) + ">")
      srlText.Add("<BR> This is a link to ")
      srlText.Add("<A HREF=" + chr(34) + "http://www.advansyscorp.com/forums/forum/3634089931-2/")
      srlText.Add(chr(34) + ">Formativ Forums</A> <BR>")
      srlText.Add(vbCrLf + "</FONT></BODY></HTML>")
    
      call utilities.savestringtofile(srlText.Text, utilities.TempFiles & "TEXT.htm", true)
    
    
      subject = "Formativ Forum Support"
      mailTo = "test@yourcorp.com"
    
      newMail.Recipients.Add mailTo, , 0
      call newMail.attachments.add(utilities.TempFiles & "TEXT.htm", fgwFile, "TEXT.htm")
    
      newMail.Subject = subject
      newMail.Send
    

    Regards,
    Advansys Support

    #5595
    MikeC
    Participant

    Thanks so much for the help. This works brilliantly.
    This also allows me to set the plain text of the email body as well for those who prefer a plain text email client.

    i had tried something similar before but not quite got it.

    #5591
    MikeC
    Participant

    I have noticed that when I set the PlainText of the email as well as having the HTML attahced, the plain text body is used in a forward or reply email and not the HTML.
    Is this something that is avoidable? It seems that this is the standard for all emails, perhaps.

    It does forward/reply on the HTML view if the PlainText is not set at all.

    Mike

    #5590
    Support 3
    Participant

    Not sure whether you can avoid this behaviour.

    Other option is to create the Mime.822 file with Plain Text and HTML section. Its a complex task to create the Mime.822 file specially you need to encode as Quoted-Printable, etc. See a Mime.822 file for details. You need to add the Mime.822 file as an attachments like the TEXT.htm file.

    Regards,
    Advansys Support

    #5594
    MikeC
    Participant

    Hello again,

    I have tried several times to attach a Mime.822 file to an email using the following method:
    call newMail.attachments.add(utilities.TempFiles & “Mime.822”, fgwFile, “Mime.822”)

    I have successfully attached the file to the outgoing email but the content of the Mime file does not end up in the body of the email.

    Is this the correct method to use or have I made a mistake in some spelling or something?

    The Mime file is structured properly and if saved with a .eml extension, it opens up with the correct views, as I would expect to see it.

    I can not seem to find much documentation on the use of Mime files in this way.
    Guidence with this would be appreciated.

    Thanks.

    #5596
    Support 3
    Participant

    You need to add the “TEXT.htm” then “Mime.822” file as an attachment. You can test it by creating a draft message in GroupWise client, add an embedded image to the message body, save the message. GroupWise will create the Mime.822 and Text.htm file, save these files to disk.

    The example code below send message using the Mime.822 file.

      
      Set newMail = GroupWise.Account.workfolder.Messages.Add("GW.MESSAGE.MAIL")
      newMail.Recipients.Add "name@gmail.com","" , 0
      newMail.subject = "Test message"
      call newMail.attachments.add("c:tempTEXT.htm", fgwFile, "TEXT.htm")
      call newMail.attachments.add("c:tempMime.822", fgwFile, "Mime.822")
      newMail.send
    

    Hope this helps.

    Regards,
    Advansys Support

    #5593
    MikeC
    Participant

    Knew it must have been something simple. This is working great now.
    Although I have noted that when forwarding on an email with a mime attachment, everything gets cut from the body tag and above as it is re-generated. This caused problems for styles but we have worked around it.

    Just wanted to state that I really appreciate the help in getting this working.

    #5592
    Support 3
    Participant

    Thanks for your feedback Smile .

    Regards,
    Advansys Support

Viewing 8 replies - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.