Created
January 24, 2012 07:56
-
-
Save martinnormark/1668751 to your computer and use it in GitHub Desktop.
Read file contents into a string variable
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MailDefinition md = new MailDefinition(); | |
md.From = "[email protected]"; | |
md.IsBodyHtml = true; | |
md.Subject = "Test of MailDefinition"; | |
ListDictionary replacements = new ListDictionary(); | |
replacements.Add("<%Name%>", "Martin"); | |
replacements.Add("<%Country%>", "Denmark"); | |
string body = String.Empty; | |
using (StreamReader sr = new StreamReader(@"C:\Path\To\File.txt")) | |
{ | |
body = sr.ReadToEnd(); | |
} | |
MailMessage msg = md.CreateMailMessage("[email protected]", replacements, body, new System.Web.UI.Control()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment