Results 1 to 6 of 6

Thread: E-mails Through Visual Basic..... ??

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2004
    Posts
    8

    Question E-mails Through Visual Basic..... ??

    I was wondering how does one make an email go through visual basic? I.E. Using VB to send an email through Outlook Express... Any idea's or code?
    Thanks


    -Phil

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    Search the Forums. Allot of examples already. Search for
    "ShellExecute" + "mailto".

    HTH
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3
    PowerPoster Keithuk's Avatar
    Join Date
    Jan 2004
    Location
    Staffordshire, England
    Posts
    2,236
    Put your email address in the lblEmail.Caption. Just click the email label and it will send using Outlook or Outlook Express.

    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" _
    2. Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal _
    3. lpOperation As String, ByVal lpFile As String, ByVal _
    4. lpParameters As String, ByVal lpDirectory As String, _
    5. ByVal nShowCmd As Long) As Long
    6.  
    7. Const SW_SHOW = 5
    8.  
    9. Private Sub lblEmail_Click()
    10.  
    11. ShellExecute Me.hwnd, "open", "mailto:" & lblEmail.Caption & "? _
    12. subject=" & App.Title, vbNullString, vbNullString, SW_SHOW
    13.  
    14. End Sub

    This as been asked a few times on here.
    Keith

    I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.

  4. #4
    isnt winsock safer? because its non OS setting dependent

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709
    ShellExecute is safe and only needs Windows NT 3.1 or later or
    Windows 95 or later.

    Only a few times? I got 123 hits on the search ShellExecute + mailto
    and have seen it asked many times going back to 1999. This is
    not a new idea.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  6. #6
    Addicted Member d.patrick's Avatar
    Join Date
    Nov 2004
    Location
    Oshkosh, WI
    Posts
    172
    You could also use the MAPI controls that come along with VB. They are pretty well documented.

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