locked
vb express 2008 email problem RRS feed

  • Question

  • Hello,

    I have managed to create a reservation application (very basic) for my use, I have a database, which I connect to from the application (it is not bound to the application) This works very well, but I am now revisiting the code as I am fed up of going to word to print and save invoices.  I wish to have three extra forms within the application, one for guest details, which are passed to form 2 to be printed as an invoice (this I can do), the trouble I am having is with form 3, I can create form 3 with details passed from form 2, but need to email this form to the guest as a receipt.  Can anyone tell me how to do this.  I have googled and googled, have found lots of code but cannot work out how to do this using Outlook Express.  I would like to email the form itself.  I have tried passing the details into the body of an email code which didn't work.  Can this be done?  Hope you can help.  Thanks

    • Moved by Mark Liu-lxf Thursday, December 22, 2011 9:05 AM Outlook Express (From:Visual Basic Express Edition)
    Wednesday, December 21, 2011 5:09 AM

Answers

  • Hi sueoldgirl,

    I don't know how to specifically send an email through Outlook Express, but I usually send emails like this:

    Imports System.Net.Mail
    
    Public Class Mail
    
    Private Sub SendEmail()
            Dim mail As New Net.Mail.MailMessage
            mail.From = New MailAddress("yourMail", "yourName")
            mail.To.Add("example@email.com")
    
            mail.BodyEncoding = System.Text.UTF8Encoding.UTF8
    
            mail.Subject = "This is a test!"
            mail.Body = "This is the body of your email. It can be the form details you need, like this:" & vbcrlf & 
            TextBoxDetail1.Text & vbcrlf & 
            TextBoxDetail2.Text & vbcrlf & 
            "... and so on!"
    
            Dim TheSmtp As New SmtpClient("yourSmtp", yourPort)
            TheSmtp.Credentials = New Net.NetworkCredential("yourMail", "yourPassword")
    
            TheSmtp.SendAsync(mail, vbNull)
    End Sub
    
    End Class



    Hope I helped a bit!
    Wednesday, December 21, 2011 1:06 PM
  • Hi sueoldgirl,

    Welcome to the MSDN forum.

    This queue is about Visual Basic Express Edition. I’m afraid that your topic about Outlook Express is unsuitable here. For better support, I will move this thread to “where is the forum for…” forum.

    You also can check this link to find more support options:  http://support.microsoft.com/gp/outlook-express

    Sorry for any inconvenience and have a nice day.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 22, 2011 9:04 AM

All replies

  • Hi sueoldgirl,

    I don't know how to specifically send an email through Outlook Express, but I usually send emails like this:

    Imports System.Net.Mail
    
    Public Class Mail
    
    Private Sub SendEmail()
            Dim mail As New Net.Mail.MailMessage
            mail.From = New MailAddress("yourMail", "yourName")
            mail.To.Add("example@email.com")
    
            mail.BodyEncoding = System.Text.UTF8Encoding.UTF8
    
            mail.Subject = "This is a test!"
            mail.Body = "This is the body of your email. It can be the form details you need, like this:" & vbcrlf & 
            TextBoxDetail1.Text & vbcrlf & 
            TextBoxDetail2.Text & vbcrlf & 
            "... and so on!"
    
            Dim TheSmtp As New SmtpClient("yourSmtp", yourPort)
            TheSmtp.Credentials = New Net.NetworkCredential("yourMail", "yourPassword")
    
            TheSmtp.SendAsync(mail, vbNull)
    End Sub
    
    End Class



    Hope I helped a bit!
    Wednesday, December 21, 2011 1:06 PM
  • Hi sueoldgirl,

    Welcome to the MSDN forum.

    This queue is about Visual Basic Express Edition. I’m afraid that your topic about Outlook Express is unsuitable here. For better support, I will move this thread to “where is the forum for…” forum.

    You also can check this link to find more support options:  http://support.microsoft.com/gp/outlook-express

    Sorry for any inconvenience and have a nice day.


    Mark Liu-lxf [MSFT]
    MSDN Community Support | Feedback to us
    Thursday, December 22, 2011 9:04 AM