Can anyone explain this
-
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);
-
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);
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!