I'm creating a MailMessage
with the code below and I'm receiving this error when calling mail.CreateMailMessage
.
Value cannot be null. Parameter name: basepath
Anyone know what could be wrong?
public void SendReciept(string reciever)
{
MailDefinition mail = new MailDefinition();
mail.IsBodyHtml = true;
mail.BodyFileName = "~/file.txt";
mail.Subject = "Subject";
mail.From = "noreply@xxx.com";
mail.Priority = System.Net.Mail.MailPriority.Normal;
MailMessage message = mail.CreateMailMessage(reciever, RecieptReplacements, new System.Web.UI.Control());
...
}
ListDictionary RecieptReplacements
{
get
{
ListDictionary replacements = new ListDictionary();
replacements.Add("<%Name%>", "Name");
return replacements;
}
}