Click to See Complete Forum and Search --> : Opening e-mail and adding an attachment
bcyde
December 14th, 1999, 06:22 PM
I want to add some functionality to an app so that when a user clicks on an email address it will open up the default email browser, so far I can do this using ShellExecute, however I also want to be able to add an attachment automatically if the user has already selected a file. I was just wondering if there was a way to do this. I'm not sure if ShellExecute would work for this, but even so if there is another way I could target certain apps such as Outlook Express and Eudora by having a command line paramter that adds the attachment that would probably work. Any help is greatly appreciated.
smalig
December 16th, 1999, 02:10 PM
Look follow samples
How to start the default e-mail application
http://vbcode.webhostme.com/en/click.asp?id=91
Using MS Outlook to e-mail
http://vbcode.webhostme.com/en/click.asp?id=92
Best Regards.
smalig@hotmail.com
http://vbcode.webhostme.com/
czimmerman
December 16th, 1999, 03:06 PM
You may want to consider bypassing the default e-mail app and sending e-mail in your application directly via winsock. There is an example at http://www.freevbcode.com/ShowCode.Asp?ID=109 that is a .dll for this purpose. Attachments are supported.
This is only for SMTP mail, so if you are supporting another kind of messaging, you can do what the other response suggested, but you will be limited to the outlook client.
bcyde
December 16th, 1999, 04:34 PM
Just wanted to say thanks to the both of you for your help.
December 20th, 1999, 02:44 AM
Hi!
I want to do the same thing that you have done, that is opening the default e-mail application, when the user clicks on the e-mail address which is
displayed in the msflexgrid. And that e-mail address should be passed on
to the To: slot of the e-mail application.
Could you please send me the code for it. I have been trying to do this
for quite some time. I would really appreciate your help.
Thanks.
bcyde
December 21st, 1999, 06:17 PM
Sorry it took so long, but my DSL line was down for a while...
Here's the API call you have to declare in a .bas module
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
and here's the function call:
Dim link As Long
link = ShellExecute(0&, vbNullString, "mailto:" & EMAIL_ADDRESS_HERE, vbNullString, vbNullString, vbNormalFocus)
where EMAIL_ADDRESS_HERE is a String variable with the user's email address
hope this helps
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.