nopSolutions / nopCommerce

ASP.NET Core eCommerce software. nopCommerce is a free and open-source shopping cart.
https://www.nopcommerce.com
Other
9.19k stars 5.27k forks source link

Add Setting for StoreOwner email address and display name #7079

Closed nealculiner closed 7 months ago

nealculiner commented 7 months ago

I'm using 4.60.6 and this similar issue has been reported many times before but after reviewing code I see how this can be easily done and make nopCommerce better for all. When we configure an email account we associate an email address for it, i.e. sales@ but that is not the store owner's email, in my case it's neal@. When I have store owner email notifications such as OrderPaid.StoreOwnerNotification this should not go to sales@ but instead the setting for the store owner account which we need support for.

I suggest a Settings > General > Email section where we can enter a store owner email address and display name. You can have a checkbox "Use mailbox default" which would be the configured email account email address but this gives me flexibility to override and define "my" email address for StoreOwner notifications, and other uses such as store error reports if they were ever wired up to be emailed. You have code in place already to resolve the StoreOwner email address, this would just need a simple modification to first check if a setting input is null or not for this, if not use the override, otherwise use as you do now.

noptools commented 7 months ago

It's not clear to me that you are asking for a feature that does not already exist. You can add additional email accounts in Admin > Email accounts, and then on a Message Template, with "Advanced mode" toggled on, you can select the email account you want to use to send the message.

nealculiner commented 7 months ago

Thank you @noptools I understand your suggestion and yeah, that probably could work. But what we are really doing in Settings > Email configuration is creating a mail server setup and should not be duplicated just to have different TO addresses. The mail server config should send customer emails, vendor emails, admin emails, store owner emails, etc. etc. I believe "separation of concerns" paradigm, the mail server configs should not be for addressing IMHO.

RomanovM commented 7 months ago

@nealculiner Thanks for the suggestion. @noptools is right, you can configure it in such a way.

noptools commented 7 months ago

I now understand Neal's concern regarding "...a mail server setup and should not be duplicated just to have different [FROM] addresses". Consider a new setting: emailaccountsettings.useDefaultEmailAccountForConnect

(The FROM addresses come form selected account, which is fine as only the field "Email address" and "Email display name" are required.)

nealculiner commented 7 months ago

Mail server configs should not be used as addressing. It is great we can enter multiple email servers and set a default or override one for different routing. It would also be good if email outbound was queued like XenForo forums does and can use fallback mail configs to send if needed, i.e. a server is down, rebooting, etc.

A mail server is one thing, addressing is another and this should be separated. We should specify in the Admin settings the default mail from address for the store, or actually in the store setting. Imagine a multi-store setup. The store owner should have a separate email address definition just as vendors do. This is how my prior ecomm platform worked and it's a simple separation of "mail server" from email addresses.

I will explore the option @noptools offered for now.

nealculiner commented 7 months ago

You can close this issue, I see how I can make this work. I confused "Email accounts" in settings with the email server configs.

noptools commented 7 months ago

@nealculiner RE: "I see how I can make this work" I'm curious; what are you doing?

(P.S. I did understand your "separation of concerns". My proposal was just an "easy" way to handle the issue with the existing structures. Although it does not address other concerns brought up in the forums about dealing with different default email accounts for multi-store. I think there should be created a new issue here to deal with email issues.)

nealculiner commented 7 months ago

I need the store owner emails to come to me neal@ and not the default I use for the store which is sales@

I also have Brevo SMTP in use as well as my on premise exchange server and now an Office365 (exchange online) mail server. My on premise exchange does not have the best email reliability as I also used it for newsletter mailings in the past so the domain/IP address range is not optimum (I used to use Lyris Listmanager self hosted).

I need to make sure any emails going out to someone other than me replyto: sales@ so I implemented that in code

It would also be nice to have some "note" showing next to an email account selection in addition to address (display name) as per above I have 3 mail servers setup all using sales@ addresses. I differentiate Display Names slightly so I know what's what.

So what I just did @noptools is I added my neal@ SMTP config and set the StoreOwner notifications to all use that so they come directly to me, the store owner.

It would be nice if there was a filter at the top of the email message templates to filter for customer notifications, store owner, and vendor, etc. but I have it all setup now and will see how it works.