Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Mail Function in vb.net

Mail Function in vb.net

Scheduled Pinned Locked Moved Visual Basic
csharp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    manuo5
    wrote on last edited by
    #1

    Hello Friends , How can we create mail Function (send mail) in window based application. Manu

    T 1 Reply Last reply
    0
    • M manuo5

      Hello Friends , How can we create mail Function (send mail) in window based application. Manu

      T Offline
      T Offline
      Tom Deketelaere
      wrote on last edited by
      #2

      this is a very simple way to do it (don't know if it will meet you expectations)

      imports system.web.mail
      ...

      Dim obj As SmtpMail ' Variable which will send the mail
      Dim Mailmsg As New MailMessage()
      obj.SmtpServer = "server:relay.skynet.be"
      Mailmsg.To = "test@test.be" 'the email adress to send to
      Mailmsg.From = "\" & (sender) & "\ <" & (sendermail) & ">" '(sender) = the name to be displayed || (sendermail) = a valid email adress from wich to send
      Mailmsg.BodyFormat = MailFormat.Text
      Mailmsg.Subject = "example"
      Mailmsg.Body = "example body"
      obj.Send(Mailmsg)

      hope this helps

      If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.

      M 1 Reply Last reply
      0
      • T Tom Deketelaere

        this is a very simple way to do it (don't know if it will meet you expectations)

        imports system.web.mail
        ...

        Dim obj As SmtpMail ' Variable which will send the mail
        Dim Mailmsg As New MailMessage()
        obj.SmtpServer = "server:relay.skynet.be"
        Mailmsg.To = "test@test.be" 'the email adress to send to
        Mailmsg.From = "\" & (sender) & "\ <" & (sendermail) & ">" '(sender) = the name to be displayed || (sendermail) = a valid email adress from wich to send
        Mailmsg.BodyFormat = MailFormat.Text
        Mailmsg.Subject = "example"
        Mailmsg.Body = "example body"
        obj.Send(Mailmsg)

        hope this helps

        If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.

        M Offline
        M Offline
        manuo5
        wrote on last edited by
        #3

        Firstly thanks . Friend my problem is that whenever we are trying to imports system.web.mail in window form it give error namespace can not find . Manu

        S T 2 Replies Last reply
        0
        • M manuo5

          Firstly thanks . Friend my problem is that whenever we are trying to imports system.web.mail in window form it give error namespace can not find . Manu

          S Offline
          S Offline
          samerh
          wrote on last edited by
          #4

          You have to add a reference System.Web and then add Imports System.Web.mail HTH

          1 Reply Last reply
          0
          • M manuo5

            Firstly thanks . Friend my problem is that whenever we are trying to imports system.web.mail in window form it give error namespace can not find . Manu

            T Offline
            T Offline
            Tom Deketelaere
            wrote on last edited by
            #5

            like 'samerh' said add a reference to system.web you can find it on the '.net' tab or at 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'

            If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.

            M 1 Reply Last reply
            0
            • T Tom Deketelaere

              like 'samerh' said add a reference to system.web you can find it on the '.net' tab or at 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'

              If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.

              M Offline
              M Offline
              manuo5
              wrote on last edited by
              #6

              Thanks For help Now Mail is working in my application . manu

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups