Home > How-To Library > Internet
How to Send Email to an Address in a Label (Text Box).
**************************************************************** * © 2007 CodeItBetter http://www.codeitbetter.com * * This notice MUST stay intact for legal use * **************************************************************** Public Const SW_SHOW = 1 Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, _ ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, _ ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long 'Create this Routine Sub Navigate(frm As Form, ByVal WebPageURL As String) Dim hBrowse As Long hBrowse = ShellExecute(frm.hwnd, "open", "MailTo:" + WebPageURL, "", "", SW_SHOW) End Sub 'Put this line in the Label(Or other Controls) CLICK EVENT Call Navigate(Me, Label1.Caption) 'Put this line in the Label MOUSEMOVE EVENT - This may be left out if you are 'using another type of control! Label1.ForeColor = &H8000000D 'Put this line in the MOUSEMOVE EVENT of every other control and the form Label1.ForeColor = &H80000012 'REMEMBER TO MAKE SURE THAT YOU USE EMAIL ADDRESSES!! 'The best thing would be to do a search of the string sent to the function and 'test that it contains an "@" symbol.
If you would like to submit your code here please us. Do not forget to mention your name. We are always thankful to each and everyone of you who submitted their code here.