mothership-ec / cog-user

User Cogule
Other
0 stars 1 forks source link

Set "from" on forgotten password email #29

Closed joeholdcroft closed 11 years ago

joeholdcroft commented 11 years ago

This could come from the merchant config file, but that is on a cogule that is not required by this cogule.

So the way I see it we could go one of three ways:

  1. Use the email in merchant config, if the merchant config group exists
  2. Add another config option for this module for the "from"
  3. Make the email component allow us to set a default "from". The commerce cogule can then set this, and this cogule needn't care if it's defined or not.

Thoughts @messagedigital/back-end-developers ? I'm leaning towards option 3.

thomasjthomasj commented 11 years ago

3 seems a little confusing, I may be misunderstanding it but could you not then set multiple defaults for the same 'from' email? I'm also not sure why it would be the commerce cogule that would be setting it?

Could this not be set in the installation?

lsjroberts commented 11 years ago

To me it seems like there should be a standard config for things like site title and emails. Possibly installed from cog so it is not dependant on anything?

joeholdcroft commented 11 years ago

3 seems a little confusing, I may be misunderstanding it but could you not then set multiple defaults for the same 'from' email? I'm also not sure why it would be the commerce cogule that would be setting it?

@thomasjthomasj Nah if you called the ->setDefaultFrom() or whatever it would end up being, it would just overwrite the previously set one.. if one was previously set, that is.

It occurs to me we don't even need new code to achieve this. We can do something like this from with a cogule's services bootstrap:

$services['mail.message'] = $services->extend('mail.message', function($message) {
    $message->setFrom('default@website.com', 'Website name'); // or get these from a config or whatever

    return $message;
});

I like that. Then the controller can call ->setFrom() again if they like to change it.

To me it seems like there should be a standard config for things like site title and emails. Possibly installed from cog so it is not dependant on anything?

@lsjroberts fair point, I have often thought this might be worthwhile though it's often seemed a bit odd to me.