public MailMessage CreateMailMessage(string recipients, IDictionary replacements, Control owner)
{
if (owner == null)
{
throw new ArgumentNullException("owner");
}
string body = string.Empty;
string bodyFileName = this.BodyFileName;
if (!string.IsNullOrEmpty(bodyFileName))
{
string path = bodyFileName;
if (!UrlPath.IsAbsolutePhysicalPath(path))
{
path = UrlPath.Combine(owner.AppRelativeTemplateSourceDirectory, path);
}
TextReader reader = new StreamReader(owner.OpenFile(path));
try
{
body = reader.ReadToEnd();
}
finally
{
reader.Close();
}
}
return this.CreateMailMessage(recipients, replacements, body, owner);
}