Results 1 to 8 of 8

Thread: vb.net hepl required with reference to outlook express

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2002
    Location
    chennai india
    Posts
    7

    Question vb.net hepl required with reference to outlook express

    i just would like to know how do we open outlook express on click of a button in vb.net form. actually it should open the new mail with to cc, subject and message fields.
    just similar to the html option.
    say in html we code the following
    mailto: [email protected], then if we click on the mail address, a new mail wizard of outlook opens up.
    we can also add the address, cc field values and also add the message too using code in html.
    i just want to know how to do the same thing in VB.NET.
    reply asap
    regards
    ramjee

  2. #2
    Member
    Join Date
    Jul 2002
    Posts
    49
    Well how I would do it is very similar to what mr polite suggested. Just instead of executing outlook execute a mailto statement.

    eg.
    Dim newprocess As New System.Diagnostics.Process()
    newprocess.Start("mailto:[email protected]")

    The mailto command is the same as the one used in html, so if you want to fill in the subject and things do it the same as you would in a html document.

  3. #3
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    umm just wanted to show an example about filling the subject line and message thingie that Matt02 mentioned:

    VB Code:
    1. Dim p As New Process()
    2. p.Start("[b]mailto:[/b][email protected][COLOR=red]?Subject=Subject goes here[/COLOR][COLOR=blue]&CC=CC goes here[/COLOR][COLOR=green]&BCC=BCC goes here[/COLOR][COLOR=tomato]&body=Message goes here"[/COLOR])

    and, if you are continuing a question, please post it in the same thread instead of making a new thread


    HTH

  4. #4
    B2E
    Guest

    Hey i got a question

    Hey is there any way to do this that you are talking about without it ever opening up outlook express so that the user sees it? Like if i want my program to automatically fill out the information for them and email it to me without them having to watch it open up outlook fill in the fields and the user having to click send.

    Or better yet does anyone know of a site or something that lets you fill out the information and them send the email from whoever the from field is filled out to

    thanks for your help

  5. #5
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    I can just tell you that you need an email server (there are free ones I guess). But I dont think it would be a good idea to rely on a free email server if you really want to sell your app
    Search pscode.com, there are many examples on this for VB6, there might be some for VB.NET too

  6. #6
    Member
    Join Date
    Jul 2002
    Posts
    49
    Okay B2E, here is the code to send an email from within .net without the user knowing it is being sent. With this code you can even send email attachments of files on their system.

    System.Web.Mail.SmtpMail.SmtpServer = "stmp.mailserver.com"
    Dim newmailmessage As New System.Web.Mail.MailMessage()

    newmailmessage.Subject = "Subject"
    newmailmessage.Body = "Message Body"
    newmailmessage.To = "[email protected]"
    Dim attachment As New System.Web.Mail.MailAttachment("C:\filename.dat")
    newmailmessage.Attachments.Add(attachment)

    System.Web.Mail.SmtpMail.Send(newmailmessage)

    Now you be good with this code.

    Opps, forgot to mention, for this code to work you will need to add a reference to the "system.web" namespace.

  7. #7
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    You dont need a smtp mail server on your computer to run this?! .NET handles the whole thing?????!

  8. #8
    Member
    Join Date
    Jul 2002
    Posts
    49
    You need to send the mail message to a mail server to recieve it. That is this bit of code

    System.Web.Mail.SmtpMail.SmtpServer = "stmp.mailserver.com"

    But, no, you don't need to be running a mail server for this. It just functions as a mail client, like outlook except that you can't recieve messages. (or maybe you can? I haven't gone through it entirely)

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