Creating an email and formatting

  • Thread starter Thread starter calvinX
  • Start date Start date
C

calvinX

Hi Everyone,

I am having a problem with sending an email from a VB.NET application. I can
send an email automatically from my application (without seeing it) but I
want to load the data into my email program so that the email will be logged
in my sent items folder for future reference.

I am using the following code


strEmail = "mailto:" & strTo & "?subject=" & strSubject & "&body=" & strbody
System.Diagnostics.Process.Start(strEmail)


This all works fine and dandy but the email is not formatted properly. I
want to preview a formatted email.

How does one do this?
Can I get a handle to the email program process and manipulate it?

Thanks

Calvin X
 
Hi Calvin,

What formatting issues do you have?

LOL. I've only just (two hours or so) posted this code in another thread -
it may be useful to you. It adds encoding so that all characters will get
through.

Regards,
Fergus

<code>
'A reference to System.Web may be necessary
'in the Project for this Import to work.
Imports System.Web.HttpUtility

Public Sub StartDefaultMail (sTo As String, _
Optional sSubject As String = "", _
Optional sMessage As String = "")
Try
sTo = UrlEncode (sTo)
sSubject = UrlEncode (sSubject)
sMessage = UrlEncode (sMessage)
Process.Start ("mailto:" & sTo & "?subject=" _
& sSubject & "&body=" & sMessage)

Catch e As Exception
MsgBox ("Couldn't start default email application" _
& vbCrLf & e.Message)
'or
Throw New Exception ("Couldn't start default email app", e)
End Try
End Sub
</code>
 
Back
Top