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. C#
  4. How to send e-mail

How to send e-mail

Scheduled Pinned Locked Moved C#
helptutorialquestion
4 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.
  • V Offline
    V Offline
    ventomito
    wrote on last edited by
    #1

    hi everyone! i'm making an application and i want to use in it an error reporting system. i want to make the program sent an email (with enclosure) without open the email browser. just send it... i want to specify the enclosure (e.g. the path of a picture). can someone help me? Thanks in advance Enrico VentoEngine corp. Program your life ^^

    G 1 Reply Last reply
    0
    • V ventomito

      hi everyone! i'm making an application and i want to use in it an error reporting system. i want to make the program sent an email (with enclosure) without open the email browser. just send it... i want to specify the enclosure (e.g. the path of a picture). can someone help me? Thanks in advance Enrico VentoEngine corp. Program your life ^^

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      For framework 1.1: System.Web.Mail namespace. For framework 2.0: System.Net.Mail namespace. --- b { font-weight: normal; }

      V 1 Reply Last reply
      0
      • G Guffa

        For framework 1.1: System.Web.Mail namespace. For framework 2.0: System.Net.Mail namespace. --- b { font-weight: normal; }

        V Offline
        V Offline
        ventomito
        wrote on last edited by
        #3

        can you give me more information? VentoEngine corp. Program your life ^^

        C 1 Reply Last reply
        0
        • V ventomito

          can you give me more information? VentoEngine corp. Program your life ^^

          C Offline
          C Offline
          Christopher Duncan
          wrote on last edited by
          #4

          Ventomito, Here's a routine I keep around for such things. You'll naturally need to insert the name of your smtp server in the slot indicated. Hope this helps. using System.Web.Mail; protected Boolean SendEmail(string strFromEmail, string strToEmail, string strSubject, string strBody) { Boolean bStat = false; try { MailMessage Message = new MailMessage(); Message.To = strToEmail; Message.From = strFromEmail; Message.Subject = strSubject; Message.Body = strBody; // enter your smtp server here // if login is required you may need extra params // see the doc for the SmtpMail object SmtpMail.SmtpServer = "your.smtpserver.com"; SmtpMail.Send(Message); bStat = true; } catch (Exception) { bStat = false; } return (bStat); } Author of The Career Programmer and Unite the Tribes Know someone who desperately needs to get a clue? Visit www.DownloadAClue.com and send them one!

          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