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. Sending mail

Sending mail

Scheduled Pinned Locked Moved C#
tutorial
5 Posts 5 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.
  • H Offline
    H Offline
    hadad
    wrote on last edited by
    #1

    Hello, I want to know how to send mail from a windows application. Thanks.

    Dad

    A A N 3 Replies Last reply
    0
    • H hadad

      Hello, I want to know how to send mail from a windows application. Thanks.

      Dad

      A Offline
      A Offline
      Ashfield
      wrote on last edited by
      #2

      If you go to the top of this page you will see a textbox labeled SEARCH. Try that, there are loads of articles and code samples. If that doesn't help, try Google, again there are lots of very good examples.

      Bob Ashfield Consultants Ltd

      1 Reply Last reply
      0
      • H hadad

        Hello, I want to know how to send mail from a windows application. Thanks.

        Dad

        A Offline
        A Offline
        Anu Palavila
        wrote on last edited by
        #3

        include //--------------------------------------------------------------------------- using System.Web.Mail; public static string SendMail(int pintUserID, string pstrMailTo, string pstrMailBcc,string pstrMailCc,string pstrMailSubject,string pstrMailBody,string pstrAttachFilePath) { try { MailMessage objMail = new MailMessage(); objMail.From = System.Configuration.ConfigurationSettings.AppSettings["FromEmailID"]; //objMail.From =System.Web.HttpContext.Current.Session["OfficeEmailID"].ToString() ; objMail.To = pstrMailTo; objMail.Bcc = pstrMailBcc; objMail.Cc = pstrMailCc; objMail.Subject = pstrMailSubject; MailAttachment Attachment = null;if (File.Exists(pstrAttachFilePath)) { Attachment = new MailAttachment(pstrAttachFilePath); } objMail.Attachments.Add(Attachment); SmtpMail.SmtpServer = "localhost";//System.Configuration.ConfigurationSettings.AppSettings["SMTPServerIP"]; SmtpMail.Send(objMail);return "TRUE"; } catch(Exception Ex) { return Ex.Message; } } Config file call the function SendMail & enable your system SMTP server.

        Thanks & Regards

        S 1 Reply Last reply
        0
        • H hadad

          Hello, I want to know how to send mail from a windows application. Thanks.

          Dad

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          http://systemnetmail.com/[^] has many examples.

          All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions

          1 Reply Last reply
          0
          • A Anu Palavila

            include //--------------------------------------------------------------------------- using System.Web.Mail; public static string SendMail(int pintUserID, string pstrMailTo, string pstrMailBcc,string pstrMailCc,string pstrMailSubject,string pstrMailBody,string pstrAttachFilePath) { try { MailMessage objMail = new MailMessage(); objMail.From = System.Configuration.ConfigurationSettings.AppSettings["FromEmailID"]; //objMail.From =System.Web.HttpContext.Current.Session["OfficeEmailID"].ToString() ; objMail.To = pstrMailTo; objMail.Bcc = pstrMailBcc; objMail.Cc = pstrMailCc; objMail.Subject = pstrMailSubject; MailAttachment Attachment = null;if (File.Exists(pstrAttachFilePath)) { Attachment = new MailAttachment(pstrAttachFilePath); } objMail.Attachments.Add(Attachment); SmtpMail.SmtpServer = "localhost";//System.Configuration.ConfigurationSettings.AppSettings["SMTPServerIP"]; SmtpMail.Send(objMail);return "TRUE"; } catch(Exception Ex) { return Ex.Message; } } Config file call the function SendMail & enable your system SMTP server.

            Thanks & Regards

            S Offline
            S Offline
            Simon P Stevens
            wrote on last edited by
            #5

            If you provide answers to fools to lazy to use Google you will only encourage them.

            Simon

            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