I inherited a project that was built on Orchard 1.6 and upgraded to 1.9. It relies heavily on IMessageManager, which is now deprecated, to send emails to users:
public void SendEmail(List<string> recipients, string subject, string body)
{
var data = new Dictionary<string, string>();
data.Add("Subject", subject);
data.Add("Body", body);
_messageManager.Send(recipients, "Event_Notification", "email", data);
}
Now I need to add dynamically generated file attachments (from a MemoryStream) to some of those mails. I'll probably have to completely rewrite this since I don't see any way to pass Attachments to the MessageManager but I'm not sure what to use as an alternative.
Orchard.Email.Services.SmtpMessageChannel already seems to do all the heavy lifting and it creates a System.Net.Mail.MailMessage which can take an AttachmentCollection but the void Process(IDictionary<string, object> parameters) method still doesn't.
Should I extend this to do what I want? If so, how? Or is there already an easier way to just tell Orchard to send an email with a title, a body and a collection of attachments to a recipient?