Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I have a public function to call default email client.
VB
Public Function OpenEmail(ByVal EmailAddress As String, Optional ByVal Subject As String = "", Optional ByVal Body As String = "") As Boolean
       Dim bAns As Boolean = True
       Dim sParams As String
       sParams = EmailAddress
       If LCase(Strings.Left(sParams, 7)) <> "mailto:" Then _
           sParams = "mailto:" & sParams

       If Subject <> "" Then sParams = sParams & _
             "?subject=" & Subject

       If Body <> "" Then
           sParams = sParams & IIf(Subject = "", "?", "&")
           sParams = sParams & "body=" & Body
       End If
   End Function


Then in Button_click, I put
<pre lang="vb"> OpenEmail("mail@asdf.com", "Subject", Body:=" of my message")

But I am unable to call the function. I want to open the client when I click button1
Thanks
Posted
Comments
koolprasad2003 22-Nov-11 4:58am    
OpenEmail() function in DLL or where ?
is it web or windowbased code ?
Al Moje 22-Nov-11 5:02am    
Try to change
Public Shared Function OpenEmail(ByVal EmailAddress As String, Optional ByVal Subject As String = "", Optional ByVal Body As String = "") As Boolean

1 solution

VB
call OpenEmail("mail@asdf.com", "Subject", Body:=" of my message")


Put this sentence in button_click event....:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900