MODX Community

Goodnews does not use the email settings from container

During installation, the sample Container was created in the Web Context. For testing I entered there email settings.

Now I would like to use my own email settings in another context with a different domain in a new NewsContainer. I have created my own chunk templates. Subscribing to Newsletter always sends the mails with Settings of the sample container.

How can I pass to GoodNewsSubscription snippet which context / container to use to send the sbscription mails.

1 Like

Could you copy and paste the snippet here? That’s probably where you will change it

The Snippet Call is:

[[!GoodNewsSubscription?
    &activationEmailSubject=`Danke, dass du dich bei [[++site_name]] zum Newsletter angemeldet hast. Bitte bestätige deine Eintragung. `
    &activationEmailTpl=`zh_News_AktivierungMail`
    &submittedResourceId=`[[!GoodNewsGetResourceID? &pagetitle=`Fast fertig`]]`
    &activationResourceId=`[[!GoodNewsGetResourceID? &pagetitle=`Du bist angemeldet`]]`
    &sendSubscriptionEmail=`1`
    &unsubscribeResourceId=`[[!GoodNewsGetResourceID? &pagetitle=`Schade`]]`
    &subscriptionEmailSubject=`Deine Anmeldung zum Newsletter bei [[++site_name]] war erfolgreich!`
    &reSubscriptionEmailSubject=`Vorhandenes Benutzerprofil oder Newsletter-Abonnement gefunden!`
    &reSubscriptionEmailTpl=`zh_News_ReAnmeldungMail`
    &profileResourceId=`[[!GoodNewsGetResourceID? &pagetitle=`Abo ändern`]]`
    &validate=`
        email:email:required`
    &defaultCategories=`1`
    &defaultGroups=`3`
]]

with my own chunks
All links are well transformed to the right context. Like [[+unsubscribeUrl]] and so on. Only the [[++emailsender]] is taken from the web-context. And the mail is also send from this mail-setting.

I tested it from another computer loged out. The same Thing

1 Like

Ok thanks for that. After reading a bit, I am not sure whether this value will be in the container at all.

There is a regular Modx system setting called emailsender, which should be the place that Goodnews is getting the email to use. I am attaching a picture of the settings, for me they are in Authentication and on the first page. (I deleted my value and then took the screenshot in order not to show personal info, was easier that way)

This should be the place that Goodnews is getting the sender address, check to confirm its the same as what you are seeing in the emails, then try changing it, flush the cache, flush all sessions, log back in and then send an email to see if the sender email has changed. (It really is important to clear out everything when making changes and being patient, using different browsers etc). Sometimes your changes are fine but the system didn’t clear out completely and you may not see the effects right away.

Its normal for the tool to use Modx system settings, its easier and you don’t have to worry about updating multiple extras when you decide to use a different email address for your system. So login, goodnews, and other extras will commonly get the data from the Modx system setting

thank you very much
But I think in GoodNews it is possible to use multiple containers with different send addresses:

The main reason for using more then one GoodNews containers is, if you are managing multiple sites or subsites in one MODX installation (using Contexts) and each site needs a separate newsletter system.
It’s also thinkable that you’d like to use different From email adresses or From names for different mailing campaigns. (GoodNews Dokumentation)

So it should be possible.
For now I know where the sender address comes from and I can use this systemsetting.

Thanks again. :beer:

Ok great! Sure, every system needs flexibility to allow users to do it just right.

For this one, you could replace [[++emailsender]] code (in the snippet I think, but I didn’t see it there) with the hardcoded email address itself.

Or, you could make your own system settings and then use [[++systemsettingname]] to get the right email, I haven’t done something like this myself, but you can definitely make your own system settings.

This would be more orderly. Imagine you had 3 websites/campaigns/issues or whatever, so you needed three sender emails. You could make system settings like this

campaignoneemail [value] oneemail@1domain

campaigntwoemail [value] twoemail@2domain

campaignthreeemail [value] threeemail@3domain

Then make three containers, and change the setting value for each one to the appropriate setting.

Again, then if you happened to need to change those emails, it would be really easy and your campaigns wouldn’t miss a beat! :smiley:

I wasn’t in office for 2 days. I thought about. I think that a systemsetting for [[++emailsender]] in the context should work.

But it is confusing for the user of the GoodNews extras that the settings of the container the value is set but not used. And it has to be set manually in the settings of the context.

I think with this the extra does not work with 2 containers with different [[++emailsender]] in the same context. But for me that does not matter to me at this time.
Greetings an thanks

Its a fair point. Extras try to be as easy to customize as possible, but they often are not perfect.

However, I just googled and found this page, saying you can make custom settings for each container, pls scroll to the bottom of this page:

http://www.bitego.com/extras/goodnews/settings/smtp-mail-settings.html

It says to right click on the container and you can change settings. Often in Modx, the tool will have default behavior, but you can get custom behavior by adding in a bit of code. See if these settings could make it easy for you

To be clear, I didn’t know Goodnews well enough to be sure about this, we figured out where the email address was coming from, it didn’t occur to me that the container might be able to override the settings. But that’s pretty common with extras, the whole point is making customization easy, so you build in the defaults and also build in easy ways to change them

Goodnews is clearly made to have multiple containers so I think it will be possible

that’s exactly what I did. I have changed these settings in my second container and they aren’t used when sending the mails. Neither the SMTP settings nor the emailsender.

I didn’t realise, that I have to set these values also for my Context. I thought the Settings of the container are enough.

Also with this behavior you can not use two containers in one context with different [[++emailsender]].

I thought the modx behavior is normally: extrasetting-> if not present -> contextsetting -> if not present -> system setting. So the Setting in the container should work. If it is the other way, it is clear why it doesnt work if contextsetting is not present.I will first try to set the [[++emailsender]] for my context and see what happens.
PS: With contextsetting it works
PSS: changing the [[++emailsender]] in container has no effect. so these settings are not used


So why these settings? And how can I use it:

Hmm that’s weird. GoodNews possibly did not consider multiple contexts

But it will take the settings by context?

yes. The context-settings works.

For me thats enough. But multiple containers in one context would not work. I have sent a mail to the developer at bitego.com with a link to this chat and the question, but he sells licenses for support. So we will see what happens.

I think its still unsolved because of this behavior.

Thank you very much.

1 Like

Ok glad it worked out finally. Yes my thinking is, for whatever reason they didn’t worry about multiple contexts. It is however strange that the container values don’t override the system settings, that’s perhaps a bug?

Note that multiple containers in one context is perfectly fine as long as you don’t want to use multiple email senders. Its reasonable to make a context for every grouping by email, not perhaps extremely convenient but acceptable.

The important thing is you got it worked out, that’s great! And you’ve helped the community by providing feedback and data

Hello and sorry for my late response!
(I’m the developer of GoodNews)

There seems to be a bit of misunderstanding of the GoodNews container settings. Container settings are used for sending newsletters - not for handling in snippets, chunks or templates. So its up to you to decide where to get your [[++emailsender]] value from. If you really like to use settings from a specific container you’d need to write a small snippet (using the MODX API) which will fetch the container settings to be used in your snippets.

This brings me to an idea for a new property for our GoodNews subscription/unsubscription snippets: e.g.

&goodNewsContainer=`123`

which will simply provide our snippets with settings values from the desired container.

I’ll set this on my todo list.

I hope this will shed some light on the issue.

Greetings,
Martin

2 Likes

Thank you very much.
Now its clear how to handle this.
Greetings
Iris