Results 1 to 16 of 16

Thread: How to open default emailer with attachment

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Question How to open default emailer with attachment

    Dear VB Expert,

    How to open default emailer with attachment thru VB6's code? .. I need advise

    Thanks & Regards
    Winanjaya

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to open default emailer with attachment

    Are you trying to read a file with the default client, or send one?

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Re: How to open default emailer with attachment

    Thanks for your prompt reply, I need to send .pdf thru default email program, when user click a button then it open default email program with .pdf attachment inserted automatically. any idea?

    Thanks & Regards
    Winanjaya

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to open default emailer with attachment

    I just searched, and found this. Hope it helps:

    http://www.vbforums.com/showthread.php?t=79636

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Re: How to open default emailer with attachment

    thanks, but how if they donot use Ms product (ie. eudora .. ) .. any comment?

    thanks
    Winanjaya

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Re: How to open default emailer with attachment

    I tried below codes, it works but I cannot insert attachment.. could any body give me tips .. how to insert attachment(s) by using below "mailto" command.

    Many thanks in advance

    Regards
    Winanjaya


    Option Explicit

    Private 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

    Const SW_SHOW = 5

    Private Sub OpenEmailer()
    If InStr(pubEmail, "@") > 0 Then
    ShellExecute Me.hwnd, "open", "mailto: [email protected]" & "?subject=" & App.Title & "&body=Hello World" , vbNullString, vbNullString, SW_SHOW
    End If
    End Sub

  7. #7
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: How to open default emailer with attachment

    What mail client are you testing with?


    Has someone helped you? Then you can Rate their helpful post.

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    784

    Re: How to open default emailer with attachment

    In development environment I am using Outlook Express, but my clients had many kinds of email client such as OE, Ms. Outlook, Eudora ..etc

    any idea?

    Thanks & Regards
    Winanjaya

  9. #9
    Super Moderator manavo11's Avatar
    Join Date
    Nov 2002
    Location
    Around the corner from si_the_geek
    Posts
    7,171

    Re: How to open default emailer with attachment

    Maybe you should try another approach. I've been reading around and it seems there is no standard way of doing this for all mail clients. Maybe you should search for MAPI or SMTP?


    Has someone helped you? Then you can Rate their helpful post.

  10. #10
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to open default emailer with attachment

    I posted a MAPI example, but it requires Outlook, which comes with Windows.

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to open default emailer with attachment

    Outlook does not come with windows, but Outlook Express does.

    Your best solution is SMTP but you need access to a SMTP Server too.
    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

  12. #12
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to open default emailer with attachment

    Oh, you can't use OE for MAPI?
    That could be a problem. I'll have to look at my mailto: section of an app.
    Drag. I have MAPI in my app. Doesn't the installer include the files that it needs?
    Last edited by dglienna; Aug 27th, 2005 at 08:20 PM.

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to open default emailer with attachment

    Um, no, I didnt say that but only clarifing that there is a difference between Outlook and Outlook Express.

    Since the poster wants to do attachments across all possible versions of a clients default email editor, then SMTP would be ideal.
    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

  14. #14
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to open default emailer with attachment

    Glad that's resolved. That would have been bad...

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: How to open default emailer with attachment

    Quote Originally Posted by dglienna
    ...I have MAPI in my app. Doesn't the installer include the files that it needs?
    Depends on your packager and the references required. If you have any Office references then you cant add their dependancies because you can not distribut Office.
    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

  16. #16
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: How to open default emailer with attachment

    Nope, just the MAPI component

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