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. Web Development
  3. Sending Emails

Sending Emails

Scheduled Pinned Locked Moved Web Development
csharpsysadminquestion
3 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.
  • L Offline
    L Offline
    LucBite
    wrote on last edited by
    #1

    Do I need to download any smtp server or do I simply just specify it in my C# code?

    ML Lingwati

    E G 2 Replies Last reply
    0
    • L LucBite

      Do I need to download any smtp server or do I simply just specify it in my C# code?

      ML Lingwati

      E Offline
      E Offline
      Expert Coming
      wrote on last edited by
      #2

      You need to specify it in you C# code, but you usually either have to download or install one to be able to use it. If you already have one, and have permissions to it, all you need to do it specify it.

      The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo

      1 Reply Last reply
      0
      • L LucBite

        Do I need to download any smtp server or do I simply just specify it in my C# code?

        ML Lingwati

        G Offline
        G Offline
        Gary Stafford
        wrote on last edited by
        #3

        You point your message to your email server. For example:

        using System.Net.Mail;

        class Emailer
        {
        private void SendEmail()
        {
        MailMessage theMessage = new MailMessage();
        MailAddress whoTo = new MailAddress("John.Doe@abc.com", "John Doe");
        MailAddress whoFrom = new MailAddress("Sue.Smith@123.com", "Sue Smith");
        theMessage.To.Add(whoTo);
        theMessage.From = whoFrom;
        theMessage.Subject = "Real Important Message";
        theMessage.Priority = MailPriority.Normal;
        theMessage.Body = "This is a real important email message.";
        theMessage.IsBodyHtml = true;

            SmtpClient client = new SmtpClient();
            client.Host = "mail.123.com"; // <- Your email server goes here
            client.Send(theMessage);
        
        }
        

        }

        Regards, Gary

        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