|
-
Oct 7th, 2003, 02:58 AM
#1
Thread Starter
Addicted Member
How to launch default Emailer?
How can I launch default emailer from my application and attach a file to Email message?
I used code, passing as a parameter string ‘mailto:[email protected]’
Dim myproc As System.Diagnostics.Process
myproc = New System.Diagnostics.Process()
Dim s As System.Diagnostics.ProcessStartInfo
myproc.EnableRaisingEvents = False
myproc.Start(strRecepient)
Is there another way of doing that?
-
Oct 7th, 2003, 05:40 AM
#2
have you tried using the System.Web ? you can add a reference to it through " Project , Add Reference " , then you can send your mail with attachments like this...
VB Code:
Dim mailclient As New Web.Mail.MailMessage()
Dim mailAttachment As New Web.Mail.MailAttachment("C:\some file")
With mailclient
.From = "Me@here"
.Subject = "the subject"
.BodyFormat = Web.Mail.MailFormat.Text
.Body = "some message from me to someone"
.Attachments.Add(mailAttachment)
End With
Dim mailServer As Web.Mail.SmtpMail
mailServer.SmtpServer = "some server eg: hotmail.com"
mailServer.Send(mailclient)
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 7th, 2003, 04:47 PM
#3
Thread Starter
Addicted Member
Thanks sysop for your suggestion, but I am using Windows Form project. The reference to Web.Mail.MailMessage is not working there.
-
Oct 7th, 2003, 05:50 PM
#4
Hyperactive Member
no all you have to do is to add the system.web.mail to your project, then it will work, irrespective of whether this is a windows or web application.
in your applicattion first of all
use the project add refence to add the system.web.services
then in your form use:
Imports System.web.mail
before or after the Public Class or End Class statement, add the import statement
Imports System.web.mail
then in the body of your code:
dim m1 as new mailmessage
' set your own parameters
' use:
Smtpmail.send(m1)
thats it, it will work, the only thing is that when you send the message, if your are not currently connected to the internet, it will give you a warning that you are not connected.
-
Oct 7th, 2003, 05:55 PM
#5
Hyperactive Member
follow up, smptp automatically refers to your default emailer
-
Oct 7th, 2003, 07:05 PM
#6
Thread Starter
Addicted Member
Thanks, Richard. Now it is working. It sends Emails from an application, but what I really need, it just open default Emailer, eg MS Outlook, or Outlook Express, attach a file to it, and after that it is up to the user to type a message, and send it manually.
-
Oct 8th, 2003, 03:37 AM
#7
if you want to launch the default mailer and add an attachment, maybe this link will help...
Add Attachments to outlook.
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
-
Oct 8th, 2003, 06:00 AM
#8
Thread Starter
Addicted Member
I downloaded and will give it a trial. The main disadvantage: it targets only Outlook Express, but I need that it works for any Emailer which is set as default at a PC.
I use another approach: MAPI controls from VB6, MAPIMessages and MAPI session. They also have one drawback: the Email message creates at the same thread, so the application is frothen until the user will send, save or delete a message. If create a separate thread for each new Email, then in the case of closing the main form, all pending Email messages are closed as well. So I have several choices to select the best approach.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|