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. Can anyone explain this

Can anyone explain this

Scheduled Pinned Locked Moved C#
saleshelpquestion
2 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.
  • T Offline
    T Offline
    totig
    wrote on last edited by
    #1

    I have the following code below to send an email. It works 100%. So I have no problem with that at all. However, if I comment out the message.Body section, and uncomment the other message.Body section, this code will no longer send out an email, and I have no idea why. Can anyone explain this? string body = "18"; SmtpMail.SmtpServer = "192.168.0.2"; MailMessage message = new MailMessage(); message.To = "ray@email.co.za"; message.From = "test@email.co.za"; message.BodyFormat = MailFormat.Text; message.Subject = subject;//"New Accident Management report on Risk Management Website"; message.Body = "http://localhost/riskmanagement/customer.aspx?refNumber=" + body; //message.Body = "http://" + HttpContext.Current.Request.Url.Host + "/RiskManagement.Presentation.WebSite/AccidentManagement/AccidentMaintenance.aspx?refNumber=" + body; SmtpMail.Send(message);

    B 1 Reply Last reply
    0
    • T totig

      I have the following code below to send an email. It works 100%. So I have no problem with that at all. However, if I comment out the message.Body section, and uncomment the other message.Body section, this code will no longer send out an email, and I have no idea why. Can anyone explain this? string body = "18"; SmtpMail.SmtpServer = "192.168.0.2"; MailMessage message = new MailMessage(); message.To = "ray@email.co.za"; message.From = "test@email.co.za"; message.BodyFormat = MailFormat.Text; message.Subject = subject;//"New Accident Management report on Risk Management Website"; message.Body = "http://localhost/riskmanagement/customer.aspx?refNumber=" + body; //message.Body = "http://" + HttpContext.Current.Request.Url.Host + "/RiskManagement.Presentation.WebSite/AccidentManagement/AccidentMaintenance.aspx?refNumber=" + body; SmtpMail.Send(message);

      B Offline
      B Offline
      benjymous
      wrote on last edited by
      #2

      Stick a breakpoint in, and check that HttpContext.Current.Request.Url.Host returns something sensible - that might be what's confusing it -- Help me! I'm turning into a grapefruit! Buzzwords!

      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