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. ASP.NET
  4. Sending Mail over Intranet

Sending Mail over Intranet

Scheduled Pinned Locked Moved ASP.NET
csharphtmlcomsysadminhelp
4 Posts 2 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.
  • N Offline
    N Offline
    NET India
    wrote on last edited by
    #1

    Hello Friends, I'm sending mail using the following code and mail is working fine. SmtpClient client = new SmtpClient(); string from = "manoj.msb1984@gmail.com"; MailAddress From = new MailAddress(from); //To whom the mail is being sent string to = "depth.heart@gmail.com"; MailAddress To = new MailAddress(to); //To whom Carbon copy is being sent if there is not don't write this code //string cc = "rawgirish@gmail.com"; //MailAddress Cc = new MailAddress(cc); //Creat an object for MailMessage MailMessage message = new MailMessage(From, To); //Set Message body HTML true otherwise sometime it send html code message.IsBodyHtml = true; //Add Your Subject message.Subject = "Add You Subject Here"; //Add Body of the Mail here string strBody = "Hello, This is Manoj Bisht <br> Got It"; message.Body = strBody; try { //Send the Mail client.Send(message); //Show sent message if mail is sent successfully Response.Write("Mail Sent Successfully"); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } But when im using this code to send email over intranet it's throwing error as shown below {"Failure sending mail."} [System.Net.Mail.SmtpException]: {"Failure sending mail."} Data: {System.Collections.ListDictionaryInternal} HelpLink: null InnerException: {"Unable to connect to the remote server"} Message: "Failure sending mail." Source: "System" StackTrace: " at System.Net.Mail.SmtpClient.Send(MailMessage message)\r\n at Rough_New.cmdSend_Click(Object sender, EventArgs e)" TargetSite: {Void Send(System.Net.Mail.MailMessage)}

    A 1 Reply Last reply
    0
    • N NET India

      Hello Friends, I'm sending mail using the following code and mail is working fine. SmtpClient client = new SmtpClient(); string from = "manoj.msb1984@gmail.com"; MailAddress From = new MailAddress(from); //To whom the mail is being sent string to = "depth.heart@gmail.com"; MailAddress To = new MailAddress(to); //To whom Carbon copy is being sent if there is not don't write this code //string cc = "rawgirish@gmail.com"; //MailAddress Cc = new MailAddress(cc); //Creat an object for MailMessage MailMessage message = new MailMessage(From, To); //Set Message body HTML true otherwise sometime it send html code message.IsBodyHtml = true; //Add Your Subject message.Subject = "Add You Subject Here"; //Add Body of the Mail here string strBody = "Hello, This is Manoj Bisht <br> Got It"; message.Body = strBody; try { //Send the Mail client.Send(message); //Show sent message if mail is sent successfully Response.Write("Mail Sent Successfully"); } catch (Exception ex) { Response.Write(ex.Message.ToString()); } But when im using this code to send email over intranet it's throwing error as shown below {"Failure sending mail."} [System.Net.Mail.SmtpException]: {"Failure sending mail."} Data: {System.Collections.ListDictionaryInternal} HelpLink: null InnerException: {"Unable to connect to the remote server"} Message: "Failure sending mail." Source: "System" StackTrace: " at System.Net.Mail.SmtpClient.Send(MailMessage message)\r\n at Rough_New.cmdSend_Click(Object sender, EventArgs e)" TargetSite: {Void Send(System.Net.Mail.MailMessage)}

      A Offline
      A Offline
      Abhijit Jana
      wrote on last edited by
      #2

      Where is your SMTP Server name ? Does your SMTP in local Intranet configured properly ?

      Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

      N 1 Reply Last reply
      0
      • A Abhijit Jana

        Where is your SMTP Server name ? Does your SMTP in local Intranet configured properly ?

        Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

        N Offline
        N Offline
        NET India
        wrote on last edited by
        #3

        <mailSettings> <smtp> <network host="192.168.1.8" port="25" userName="myuserName" password ="1234"></network> </smtp> </mailSettings>

        A 1 Reply Last reply
        0
        • N NET India

          <mailSettings> <smtp> <network host="192.168.1.8" port="25" userName="myuserName" password ="1234"></network> </smtp> </mailSettings>

          A Offline
          A Offline
          Abhijit Jana
          wrote on last edited by
          #4

          .NET- India wrote:

          InnerException: {"Unable to connect to the remote server"}

          Your exception says that, you system is not able to connect with the remote server. Please check the connectivity between them.

          Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.

          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