Jump to content

Specific mail on newsletter signup

Pete Nice

Recommended Posts

So here's what I'm trying to achieve:

Supply a voucher code if you signup to the newsletter when you set up your account.
I can add the code to non-registered users email but how can I send a specific email if you check the newsletter box on sign up?

Any help would be appreciated.

Share this post

Link to post
Share on other sites

For anyone that may want to solution - here's what I did:

In authentication.php I've added in the first line to the script where it checks if the new user has checked the newsletter box - $customer->newsletter_check = "Your 15% Off Voucher code is: NL01";:

$customer = new Customer();
       if (Tools::isSubmit('newsletter'))

          $customer->newsletter_check = "Your 15% Off Voucher code is: NL01";
           $customer->ip_registration_newsletter = pSQL(Tools::getRemoteAddr());
           $customer->newsletter_date_add = pSQL(date('Y-m-d H:i:s'));

Then added that element in to the array to output to the email that gets sent - {newsletter}' => $customer->newsletter_check :

if (!Mail::Send(intval($cookie->id_lang), 'account', 'Welcome!', 
                       array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname,'{newsletter}' => $customer->newsletter_check, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname))

Then in my email template added {newsletter} where I wanted it to echo out.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More