Customizing Emails by Language
Last edited: 1/17/2025
When you register a user, you can create meta-data about them.
Creating meta-data with the JS-Client's signUp function
_11const { data, error } = await supabase.auth.signUp({_11 email: 'email@some_[email.com](http://email.com/)',_11 password: 'example-password',_11 options: {_11 data: {_11 first_name: 'John',_11 last_name: 'Doe',_11 age: 27,_11 },_11 },_11})
The above example creates a user entry that includes information about their name and age. The data is stored in the auth.users table in the auth.raw_user_meta_data
column. You can view it in the auth schema with the SQL Editor.
It can be accessed in a project's Email Templates. Below is an example:
If you need to update a user's meta-data, you can do so with the updateUser function.
The meta-data can be used to store a users language preferences. You could then use "if statements" in the email template to set the response for a specific language:
_10{{if eq .Data.langauge "en" }}_10<h1>Welcome!</h1>_10{{ else if eq .Data.langauge "pl" }}_10<h1>Witamy!</h1>_10{{ else }}_10<h1>chuS'ugh, tera' je (Klingon)</h1>_10{{end}}
Supabase uses the Go Templating Language to render emails. It has advanced features for conditions that you may want to explore. For more examples, there is a GitHub discussion that discusses advanced language templates.