IEmailSenderService
The IEmailSenderService handles all e-mails which are sent out in Veva. There are two standard implementations available, one uses standard SMTP and is a part of the Lisa.Core.Infrastructure.MailKitMailer module. The other one uses SendGrid and is contained in the Lisa.Modules.Mail.SendGrid module.
If you like to use a different method to send e-mails, you can implement your own e-mail service by implementing the IEmailSenderService interface. There can be multiple implementations registered, but only one is used at a time. You can configure which e-mail service to use in the global settings dialog in Veva, which will show you a list of all registered implementations. Just select the one you want to use, configure it and hit save.
Interface declaration
public interface IEmailSenderService { SendMailResponse SendMail(string to, string fromName, string fromAddress, string subject, string body, bool isHtmlBody = true); SendMailResponse SendMail(string to, string subject, string body, bool isHtmlBody = true); SendMailResponse SendMail(MailMessage message); }
Example
No example at the moment.
Registration
This is how the implementation is registered into the DI container in Veva, this should be done in your module config file (The class which implements IModule).
public void ConfigureServices(IServiceCollection services, IConfiguration configuration) { services.AddNamed<IEmailSenderService, MyEmailSenderService>("MyEmailSenderService"); }