Custom Unsubscribe page or manual unsubscribe?

  1. 9 months ago

    I am trying to figure out how to customize my unsubscribe page, and manually unsubscribe contacts from certain segments. Right now, when someone unsubscribes from an email, they are directed to a plain white page with large black text saying, "We are sorry to see you go! (Their email address) will no longer receive emails from us. If this was by mistake, click here to re-subscribe."

    I'm looking to accomplish two things:

    1. I would like to customize that unsubscribe page, as it is pretty plain. But, I don't see anywhere I can make changes to the page.

    2. I would like to manually unsubscribe contacts from our email lists if necessary. On rare occasions, a contact will email us and as to be removed from our email list (even though we have an unsubscribe link in all email blasts). Is there a way to manually unsubscribe a contact from a list? I realize that I could just remove them from the list, but I want the red "Do Not Contact" tag to appear on the contact page like it does when they click "unsubscribe." That way, we don't accidentally send them anymore emails.

    Please let me know if this is possible.

  2. Check this out https://medium.com/@NinJoan/simplest-way-to-make-a-unsubscribe-system-for-mautic-4f307850cce2
    @shanse2

  3. 8 months ago

    @shanse2 other way:

    • you can create beautiful unsubscribe page somewhere on your main non-mautic-site (wordpress for example)
    • add custom plugin to Mautic to create redirect to that page (3-files below - just change YOUR_CUSTOM_URL to your URL)

    3 files:
    // plugins\MauticUnsubscribeRedirectBundle\MauticUnsubscribeRedirectBundle.php

    <?php
    
    namespace MauticPlugin\MauticUnsubscribeRedirectBundle;
    
    use Mautic\PluginBundle\Bundle\PluginBundleBase;
    
    class MauticUnsubscribeRedirectBundle extends PluginBundleBase
    {
        public function getParent()
        {
            return 'MauticEmailBundle';
        }
    
    }

    // plugins\MauticUnsubscribeRedirectBundle\Config\config.php

    <?php
    
    return array(
        'name'        => 'Unsubscribe redirect',
        'description' => 'Helps to redirect Lead after unsubscribe',
        'version'     => '1.0',
        'author'      => 'Me',
    
    
        'routes' => [
            'public' => [
                'mautic_email_unsubscribe' => [
                    'path'       => '/email/unsubscribe/{idHash}',
                    'controller' => 'MauticUnsubscribeRedirectBundle:Public:unsubscribe',
                ],
            ],
        ],
    
    );

    //plugins\MauticUnsubscribeRedirectBundle\Controller\PublicController.php

    <?php
    
    namespace MauticPlugin\MauticUnsubscribeRedirectBundle\Controller;
    
    use Mautic\EmailBundle\Controller\PublicController as BaseController;
    
    class PublicController extends BaseController
    {
        public function unsubscribeAction($idHash)
        {
            ob_start();
            parent::unsubscribeAction($idHash);
            ob_end_clean();
            return $this->redirect('YOUR_CUSTOM_URL');
        }
    
    }

    - then upload MauticUnsubscribeRedirectBundle folder to you Mautic "plugins/" folder, clear prod cache and re-install plugin at you Dashboard/Settings/Plugins by select action "s/plugins/reload"

  4. Edited 8 months ago by olimits7

    @y.tselischev Great plugin, exactly what I was looking for! :)

    Quick question, would it be possible to have the "re-subscribe" and "un-subscribe" links showing like it works on the default Mautic page on this redirect page?

    For example, show the following text on the "un-subscribe" redirect page:

    We are sorry to see you go! |EMAIL| will no longer receive emails from us. If this was by mistake, <a href='|URL|'>click here to re-subscribe</a>.

    And if they click on the click here to re-subscribe link we will redirect to a "re-subscribe" page that will show the following text.

    |EMAIL| has been re-subscribed. If this was by mistake, <a href='|URL|'>click here to unsubscribe</a>.

    Maybe we can create 2 "redirect" pages; like the following that contain the "idHash" values this way we can include the Mautic links below so it works properly?

    - YOUR_CUSTOM_UNSUBSCRIBE_URL
    > http://www.domain.com/unsubscribe

    <body>
        <a href="http://mautic.domain.com/email/resubscribe/{idHash}">
         If this was a mistake, click here to resubscribe
        </a>
    </body>

    - YOUR_CUSTOM_RESUBSCRIBE_URL
    > http://www.domain.com/resubscribe

    <body>
        <a href="http://mautic.domain.com/email/unsubscribe/{idHash}">
         If this was a mistake, click here to unsubscribe
        </a>
    </body>

    Is there a way we can pass the "idHash" this way we could include these links in the custom redirect pages?

    Thank you.

  5. @olimits7
    You can add resubscribe link to your custom page by passing idHash in URL as parameter, change

    return $this->redirect('YOUR_CUSTOM_URL');

    to

    return $this->redirect('YOUR_CUSTOM_URL?id_hash='.$idHash);

    then catch id_hash as $_REQUEST['id_hash'] at your custom unsubscribe page and then use it to generate resubscribe URL. (Rules are http://yourmautic.com/email/unsubscribe/{idHash} and http://yourmautic.com/email/resubscribe/{idHash} ).
    Also you need to override resubscribe urls like it done already for unsubscribe in plugin. ( I didn't test code below :) )

    // plugins\MauticUnsubscribeRedirectBundle\Config\config.php

    <?php
    
    return array(
        'name'        => 'Unsubscribe redirect',
        'description' => 'Helps to redirect Lead after unsubscribe',
        'version'     => '1.0',
        'author'      => 'Me',
    
    
        'routes' => [
            'public' => [
                'mautic_email_unsubscribe' => [
                    'path'       => '/email/unsubscribe/{idHash}',
                    'controller' => 'MauticUnsubscribeRedirectBundle:Public:unsubscribe',
                ],
                'mautic_email_resubscribe' => [
                    'path'       => '/email/resubscribe/{idHash}',
                    'controller' => 'MauticUnsubscribeRedirectBundle:Public:resubscribe',
                ],
            ],
        ],
    
    );

    //plugins\MauticUnsubscribeRedirectBundle\Controller\PublicController.php

    <?php
    
    namespace MauticPlugin\MauticUnsubscribeRedirectBundle\Controller;
    
    use Mautic\EmailBundle\Controller\PublicController as BaseController;
    
    class PublicController extends BaseController
    {
        public function unsubscribeAction($idHash)
        {
            ob_start();
            parent::unsubscribeAction($idHash);
            ob_end_clean();
            return $this->redirect('YOUR_CUSTOM_UNSUBSCRIBED_PAGE_URL?id_hash='.$idHash);
        }
        public function resubscribeAction($idHash)
        {
            ob_start();
            parent::resubscribeAction($idHash);
            ob_end_clean();
            return $this->redirect('YOUR_CUSTOM_RESUBSCRIBED_PAGE_URL?id_hash='.$idHash);
        }
    }

    p.s. and if you want to pass email to your custom unsubscribe page - you can pass it smth like (not tested):

        public function unsubscribeAction($idHash)
        {
            ob_start();
            parent::unsubscribeAction($idHash);
            ob_end_clean();
    
            $model = $this->getModel('email');
            $stat  = $model->getEmailStatus($idHash);
            $email = $stat->getEmail();
            return $this->redirect('YOUR_CUSTOM_UNSUBSCRIBED_PAGE_URL?id_hash='.$idHash.'&email='.$email);
        }
  6. Edited 8 months ago by olimits7

    @y.tselischev Ok, great...thank you! :)

    I tested this and the custom unsubscribe/resubscribe pages with the idHash seem to work properly!

    However, I tested the email code and my custom unsubscribe page that I was redirected showed the following:

    http://YOUR_CUSTOM_UNSUBSCRIBED_PAGE_URL?id_hash=58956e64a54e2&email=Proxies\__CG__\Mautic\EmailBundle\Entity\Email%20with%20ID%20#62

    It looks like the email isn't getting passed properly to the custom unsubscribe page.

    Thank you!

  7. @olimits7 I told it was not tested:)

    try to use

    $email = $stat->getEmailAddress();

    instead

    $email = $stat->getEmail();
  8. @y.tselischev I don't mind testing! :) It will be a nice plugin to have one it's working properly.

    Ok, I'll give this a shot and let you know!

    Ty.

  9. @y.tselischev Yeah, it works now...thank you for your help with this! :)

    This plugin makes it a lot easier now to make the unsubscribe/resubscribe page look a lot more professional.

  10. @olimits7 welcome

 

or Sign Up to reply!