I will be deploying my project to Azure, which doesn't support SMTP. I have created a new EmailSenderSendGrid class that implements IEmailSender but uses the SendGrid API.
I then added:
IocManager.Register<IEmailSender, EmailSenderSendGrid>();
to the PostInitialize() method of my ProjectNameCoreModule.cs (in the Core project) in an attempt to register the new implementation. However, when I attempt to send an email from an MVC controller, it throws and exception and that exception is coming from Abp.MailKit.MailKitEmailSender. So that implies it's still trying to use MailKit and not my class. What am I doing wrong?
This is the first time I am trying to use the IocManager to register my own implementation...so perhaps I am screwing that up.
Thanks, Bryan
3 Answer(s)
-
0
Hi @blewis,
Can you try to replace IEmailSender implementation like this in PreInitialize of your module.
Configuration.ReplaceService<IEmailSender, EmailSenderSendGrid>(DependencyLifeStyle..Transient);
-
0
Thanks. This worked!
-
0
Great :)