Results 1 to 6 of 6

Thread: HTML E-mail.

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2016

    HTML E-mail.


    Below is my code, Below code generates email in HTML but messes up the output from the Richtextbox.

     Private Sub Button3_Click_1(sender As System.Object, e As System.EventArgs) Handles Button3.Click
            Dim OutApp As Object
            Dim OutMail As Object
            Dim strbody As String
            Dim Tme As String = DateTimePicker1.Text
            Dim Rich As String = RichTextBox1.Text
            OutApp = CreateObject("Outlook.Application")
            OutMail = OutApp.CreateItem(0)
            strbody = RichTextBox1.Text
            '+ vbNewLine + vbNewLine + "At" + " " + Tme + "," + " " + Site + vbNewLine + vbNewLine)
            On Error Resume Next
            With OutMail
                .To = "*****"
                .CC = ""
                .BCC = ""
                .Subject = "This is the Subject line"
                .HTMLBody = strbody & "<br>" & .HTMLBody
            End With
            On Error GoTo 0
            OutMail = Nothing
            OutApp = Nothing
        End Sub

    Output i am getting from the RichTextbox in the Email.

    Dear All , At 17:20, Our Portal. 1.Open 2.Close

    Required out put which is Richtextbox .

    Dear All ,
    17, Our Portal.   
    Last edited by dday9; Sep 26th, 2016 at 09:49 AM. Reason: Corrected Code Tags

  2. #2
    Wall Poster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Columbus, Ohio

    Re: HTML E-mail.

    It looks to me like you are mixing HTML and VB syntax together. HTML is not what is used in a RTB as far as I know.

    This is what I would expect for HTML:

    '<html><font face="Verdana"><font size="2">
    <br><br>Thank you for choosing XXXXXX as your Ohio workers’ compensation service provider and group rating program administrator.<br>
    <br><br>We filed your Grow Ohio group rating application with the Ohio Bureau of Workers’ Compensation (BWC) and they have accepted your enrollment.
    Your premium obligation to BWC will immediately reflect the reduced group rates.<br>
    <br><br> You will receive information annually from our office for continued participation in group rating or an alternative rating program. <br>
    Please remember next time...elections matter!

  3. #3
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    South Louisiana

    Re: HTML E-mail.

    Hi adgjmpt,

    I wanted to give you a heads up, I corrected your code tags. They were setup like this:

    When they should've been setup like this:

    Also, I masked your email address. The last thing that you want is for someone to start spamming you.

  4. #4

    Thread Starter
    New Member
    Join Date
    Sep 2016

    Re: HTML E-mail.

    I actually do not to loose my E-mail signature and had to go with HTML is there any way i can get the RTB data as it is in the E-mail without any Modifications done by HTML.

  5. #5
    PowerPoster SJWhiteley's Avatar
    Join Date
    Feb 2009
    South of the Mason-Dixon Line

    Re: HTML E-mail.

    You will need to convert the RichTextBox to HTML manually or using a library. Just do a search, and find appropriate code you like.
    "Ok, my response to that is pending a Google search" - Bucky Katt.
    "There are two types of people in the world: Those who can extrapolate from incomplete data sets." - Unk.
    "Before you can 'think outside the box' you need to understand where the box is."

  6. #6
    PowerPoster techgnome's Avatar
    Join Date
    May 2002

    Re: HTML E-mail.

    Also, be aware that the .Text property of an RTB is jsut that... the TEXT... it does NOT include any of the RTF encoding... there is an RTFText property for that ... this will be important for converting to HTML as you'll want to pass the RTFText and not Text...

    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width