Page 1 of 3
Unsubscribe link in mailing list email
Posted: Mon May 25, 2020 4:32 pm
by Eddie
Hi Stephen,
What is the best way to add an unsubscribe link in the email of a the mailing list email plugin?
Ideally I would like an email send to the administrator with unsubscribe and that the user is automatically deleted as a user.
Maybe a field for a signature where you can save html in would also work.
What do you think on this?
Cheers
Ewoud
Re: Unsubscribe link in mailing list email
Posted: Mon May 25, 2020 5:05 pm
by stephenbillard
You can insert links into the text, so you could have a mail-to link, but there is not a way to fill the body of the mail. That mail would come to the link you provide. (web apps cannot easily receive e-mail.) The link could be a unique e-mail address in your domain, eg.
unsubscribe@yourdomain.com. You would then have to manually unsubscribe the user.
You should be able to insert signatures via HTML as well or you can include a signature in your "form" file.
Mostly this is probably not a satisfactory solution. We would need to add features to the mailing list plugin to create a unsubscribe capability.
Re: Unsubscribe link in mailing list email
Posted: Mon May 25, 2020 6:50 pm
by Eddie
That would be perfect as a feature. Are you open to add it as a feature of the plugin? Otherwise I'll take the html route.
Re: Unsubscribe link in mailing list email
Posted: Mon May 25, 2020 10:10 pm
by stephenbillard
I have concluded that the best way to add this feature is via the mailform template. A link can be included as part of the form that takes the user to an unsubscribe page. Of course, some support needs to be added to nPG to implement the ignore list in the mail sendings. I have built this into the development release:
https://github.com/sbillard/netPhotoGra ... Dev_2.0%2B
The user_mailing_list plugin now has an option which lists the site users. Those with checkmarks have elected to unsubscribe. You can override that by un-checking them in the option list.
The plugin documentation describes the link needed for the mailform. The distributed mailform includes the link in the lower right of the email form as an example.
There is a new page as part of the user_mailing_list that the link directs the user to. Clicking the link will end up removing the user from the user_mailing_list recipient list. (You can get him back via the above mentioned options.) THe one caveat is that the user must be logged in which should not be an issue. He will get a login screen if he is not. He also must have USER_RIGHTS in order to opt-out (or make any other changes to his credentials.)
Re: Unsubscribe link in mailing list email
Posted: Tue May 26, 2020 6:24 am
by Eddie
You are an absolute genius. I just tested this and it works really well.
I just noticed the message is a bit strange when you un-subscribe.
"You are no longer subscribed to the Home mailing list".
Is it possible to make it the site title and maybe create a multi-lingual field for this message?
Very happy though!
Re: Unsubscribe link in mailing list email
Posted: Tue May 26, 2020 6:36 am
by Eddie
I just tried to untick a unsubscribed user (as admin) to resubscribe the user. The plugin function does not let me untick the user, is that expected behavior? And when I resubscribe as the user it brings me to the subscribe page but without a message (i.e.You are re-subscribed) and the tick box remains ticked.
Re: Unsubscribe link in mailing list email
Posted: Tue May 26, 2020 7:07 am
by Eddie
Also, if I would add some code to the subscription page (I want to hide the navigation via javascript), how can I make sure it is not overwritten via an update?
Re: Unsubscribe link in mailing list email
Posted: Tue May 26, 2020 2:28 pm
by stephenbillard
The "name ("Home" in your case) is the title of your gallery. The text of the message is done with gettext() so it is translatable and will be in the user's language if the site is multi-lingual. Of course there has to be a translation done first. Any volunteers for doing translations?
What form were you un-ticking the user? In the plugin options? I am not seeing a problem with unchecking them.
Re: Unsubscribe link in mailing list email
Posted: Tue May 26, 2020 3:15 pm
by stephenbillard
If you want to create your own script to handle the subscriptions you can do so by making a customized version of the mailform. Just put the link you want in place of the one that is in the template.
Re: Unsubscribe link in mailing list email
Posted: Tue May 26, 2020 3:46 pm
by Eddie
When the the admin tries to untick a regular user in plugin options, he cannot undo the tick. He can deselect his own, but not from another user in my case.