Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Newsletter subscribeEmail.ss not being used


Go to End


5 Posts   1488 Views

Avatar
potion_maker

Community Member, 36 Posts

24 June 2009 at 8:48am

When a user subscribes to the newsletter they receive an email but the email is not using the SubscribeEmail.ss template. They were receiving no emails until i selected the "Send copy of submission to this address" checkbox under the Form tab of my Subscribe Form page. I think I am just missing the proper place to tell SS to send out the subscribe email and instead it using the "Send copy of submission to this address" option. Anyone had this problem. Thanks

Avatar
SilverRay

Community Member, 167 Posts

27 June 2009 at 7:20am

I have the same problem, and am still looking for a solution. Apparently it uses the generic email template in the user defined forms module...

Avatar
SilverRay

Community Member, 167 Posts

27 June 2009 at 8:02am

So, the following code in SubscribeForm.php should send the right email (as you've probably already seen), but for some reason it doesn't do it:

        $templateData = array(
            'Email' => $member->Email,
            'FirstName' => $member->FirstName,
            'Newsletters' => new DataObjectSet( $newsletters ),
            'UnsubscribeLink' => Director::baseURL() . 'unsubscribe/index/' . $member->Email
        );
        
        $email = new SubscribeForm_SubscribeEmail(); 
        $email->setFrom( Email::getAdminEmail() );
        $email->setSubject( $this->Subject );
        
        $email->populateTemplate( $templateData );
        $email->send();

Anyone?

Avatar
SilverRay

Community Member, 167 Posts

27 June 2009 at 10:37pm

Edited: 27/06/2009 10:37pm

Spent all day debugging this problem, but no worky. Nobody has this problem, really?

Avatar
SilverRay

Community Member, 167 Posts

28 June 2009 at 9:36pm

Ha! Solved it. Totally overlooked it, but it didn't set the To field. There's actually a patch too:

http://open.silverstripe.org/ticket/3957

Should have looked in trac. Will do so more in the future ;)

Hope this helps you too, potion_maker.