We help IT Professionals succeed at work.
Get Started

VB.Net Save HTML Mail Message to TXT or RTF File Format

JB4375
JB4375 asked
on
2,064 Views
Last Modified: 2012-04-16
I have a simple subroutine that takes data pulled from a web form and submits an email request.

Ultimately, rather that sending the email I want it to save the email as an RTF file that retains the formatting.

If this isn't possible could someone give me a simple example of how to create the RTF with the same parts of the email? Code below.

Thanks,

JB


    Public Sub Send_Email()
        Dim Mail As New MailMessage()
        Dim mailBody As String

        Mail.From = New MailAddress("netadmin@domain.com")
        Mail.To.Add(strUser & "@domain.com")
        Mail.Subject = "Issue with Request Form"
        mailBody = "The following issue: " & DropDownList1.SelectedItem.Text & " has been reported by " & strUser & "." & "<br/>" & "<br/>"
        mailBody &= "Problem Description: " & TextBox5.Text & "<br/>" & "<br/>"
        mailBody &= "Thank you," & "<br/>" & "<br/>"
        mailBody &= "Information Services" & "<br/>"
        Mail.Body = mailBody
        Mail.Priority = MailPriority.High ' Normal, Low or High
        Mail.IsBodyHtml = True

        Dim smtp As New SmtpClient("mail.domain.com")
        Try
            smtp.Send(Mail)
        Catch ex As Exception
            MsgBox(Err.Description & vbCrLf & ex.ToString)
            Exit Sub
        End Try
    End Sub
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2014
Commented:
This problem has been solved!
Unlock 2 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE