FluentEmail icon indicating copy to clipboard operation
FluentEmail copied to clipboard

Redundant From in DI

Open HavermansStef opened this issue 5 years ago • 0 comments

"The specified string is not in the form required for an e-mail address"

A few hours of hitting desks and using a hundred different recipient addresses, I found out From was missing. It's sporadically present in the documentation. I don't know why if you add the property via DI; eg: services.AddFluentEmail("[email protected]") .AddRazorRenderer() .AddSmtpSender(new SmtpClient("[email protected]", smtpSettings.Port) { Credentials = new NetworkCredential(smtpSettings.Account, smtpSettings.Password), EnableSsl = true }); it still needs to be added again in the From parameter? Wouldn't it be better to add the mail passed on here as the default ?

I also think the error handling around this is poor. It wouldn't hurt anybody to put a bit more detailed error message that says 'The 'From' address is not valid.'

HavermansStef avatar Nov 18 '20 13:11 HavermansStef