postal icon indicating copy to clipboard operation
postal copied to clipboard

Unable to change mailSettings on a per email basis

Open ngudritz opened this issue 9 years ago • 2 comments

I have default smtp settings configured in the web.config, but we need to be able to change the sender credentials based on the type of email going out. It looks like no matter what, Postal uses what's in the web.config without a way of overriding it. Is this true or is there another way to the smtp credentials for a single email at runtime?

ngudritz avatar Jun 17 '15 15:06 ngudritz

It doesn't look like a single email can be overridden, but you can override the SMTP client creation: https://github.com/andrewdavey/postal/blob/master/src/Postal/EmailService.cs

That would require you to create a new instance of EmailService every time you wanted to send an email, rather than injecting an instance in your object's constructor.

I can see something like this being useful in a handful of projects, so if you can elaborate on your use-case(s) a bit, I could take a stab at something a little more "friendly".

tiesont avatar Jun 17 '15 23:06 tiesont

It would be great if the SMTP could be configured using code as well. A use case is that i do not want to store passwords in the Web.config, b/c we are required to store the credentials in a key vault.

iamgurdip avatar Mar 14 '16 14:03 iamgurdip