Tesla encourages the commmunication between current and future owners of a Tesla. Conditions for a valid distribution and use of the referrral specify the following as allowed:
Youtube channels, informative (fan)sites and sharing on social media. Other actions not not allowed: advertising, commercial emailing,..
So you will be able to use above code without problems nor risks.
Extract from the Tesla website (referral action started 30th of May 2019):
"You and anyone using your referral link to buy a Tesla will receive 1.500 free Supercharger km!
Each referral now also gives you a chance to win a Founders Series Model Y or Roadster supercar! Tesla owners who already have free Supercharging get two chances to win.
Tesla cars have the lowest overall probability of injury according to US government NCAP testing, so every referral helps reduce your friend’s chances of injury or death.
Thank you for helping accelerate the world's transition to sustainable energy."
More info:
www.tesla.com/nl_BE/support/referral-program or on your local Tesla site.