Results 1 to 8 of 8

Thread: How to launch default Emailer?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182

    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?

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    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:
    1. Dim mailclient As New Web.Mail.MailMessage()
    2.         Dim mailAttachment As New Web.Mail.MailAttachment("C:\some file")
    3.         With mailclient
    4.             .To = "[email protected]"
    5.             .From = "Me@here"
    6.             .Subject = "the subject"
    7.             .BodyFormat = Web.Mail.MailFormat.Text
    8.             .Body = "some message from me to someone"
    9.             .Attachments.Add(mailAttachment)
    10.         End With
    11.  
    12.         Dim mailServer As Web.Mail.SmtpMail
    13.         mailServer.SmtpServer = "some server eg: hotmail.com"
    14.         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]

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    Thanks sysop for your suggestion, but I am using Windows Form project. The reference to Web.Mail.MailMessage is not working there.

  4. #4
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    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.

  5. #5
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Dublin (Ireland)
    Posts
    304
    follow up, smptp automatically refers to your default emailer

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    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.

  7. #7
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    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]

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    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
  •  



Click Here to Expand Forum to Full Width