Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Send Email

Lego614Lego614 Member Posts: 32
Could someone give the code to send a text email from VB.NET?

I know it uses something like system.web.mail, but I don't know how.

Comments

  • ultimageultimage Member Posts: 119
    [b][red]This message was edited by ultimage at 2005-5-4 10:54:14[/red][/b][hr]
    : Could someone give the code to send a text email from VB.NET?
    :
    : I know it uses something like system.web.mail, but I don't know how.
    :
    You will have to supple the smtp server.

    you need several text boxes on a form, name them:
    txtEmailAddress
    txtEmailAddress
    txtEmailBody
    txtEmailSubject
    txtSMTPServer

    Just create these text boxes on a form and include these lines as well in the declarations section:

    [code]
    Imports System.Web
    [/code]


    then paste this code onto the form in a command button:

    [code]
    Dim email As New System.Web.Mail.MailMessage
    email.To = txtEmailAddress.Text
    email.From = txtEmailAddress.Text
    email.Body = txtEmailBody.text
    email.Subject = txtEmailSubject.text
    System.Web.Mail.SmtpMail.SmtpServer = txtSMTPServer.Text
    System.Web.Mail.SmtpMail.Send(email)
    [/code]

    hope this helps


    Ultimage
    ultimage@insightbb.com



Sign In or Register to comment.