1
Vote

A piece of code to set a specific sender name (eg: commercial name) with your emails

description

Right now, without this setting and to be more generic, I use the current site name directly in the code
var siteName = _orchardServices.WorkContext.CurrentSite.SiteName; // Evolutive
context.MailMessage.From = new MailAddress(smtpSettings.Address, siteName);
Thanks

comments

BertrandLeRoy wrote Nov 25, 2013 at 8:04 AM

This looks more like a question than an issue. Can you please explain exactly what you're asking?

jtkech wrote Nov 25, 2013 at 1:52 PM

Currently in the code, the MailAddress Constructor use only one parameter, the email address. It does not use the display name associated with this address (displayName)

This second parameter is useful, you can set it with a commercial name, and when someone receive an email he can see it in place of the email address

So, my suggestion was to add a new parameter for this property in the email settings (smtpSettings) on the dashboard

But today, I have seen in the MSDN doc that with only the first parameter you can add the display name to the email address, like that: "Tom Smith tsmith@contoso.com"

I have tried the same thing with my email address on the dashboard. And it works without Orchard code modification

Sorry for the inconvenience

jtkech wrote Nov 25, 2013 at 1:59 PM

Note : You have to enclose the email address in angle brackets. These was not dislayed in the previous comment

"DisplayName <emailAddress>"

sebastienros wrote Jul 1 at 8:00 PM

We already have some code somewhere to add cc/bcc and maybe the sender on the workflow tasks.

sebastienros wrote Jul 1 at 8:01 PM

And maybe also the code in the API to take these other parameters into account.

sebastienros wrote Jul 1 at 8:02 PM

Bertrand says it's in 1.8.1, let's check