Sending Emails
Sending e-mails is what Magic Login is all about.
post
https://api.magiclogin.net
/v1/{app_id}/sendTemplateEmail
Send Template Email

TemplateEmailContent

The data in this object describes everything in the e-mail that is not style related.
1
interface EmailTemplateContent {
2
/**
3
* OPTIONAL
4
* The preheader is the summary text that follows a subject line when the email is viewed in an inbox.
5
* In many cases, it's used to provide a short summary of the email, and is typically one sentence long.
6
*
7
* NOTE: This content is not visible in the e-mail itself, only the inbox.
8
*/
9
preheader?: string;
10
​
11
/**
12
* OPTIONAL
13
* The URL and name of the product used in the link at the top of the e-mail.
14
* You should point this at the homepage of your app/website.
15
*
16
* Defaults to the Application name and URL.
17
*/
18
product?: {
19
url: string;
20
name: string;
21
}
22
/**
23
* OPTIONAL
24
* The main text content of your e-mail that appears above the action button.
25
*
26
* Markdown enabled.
27
*/
28
main?: string;
29
30
/**
31
* OPTIONAL
32
* Describes the main action button in the e-mail.
33
* If you don't specify the action object, there will be no button in the e-mail.
34
*/
35
action?: {
36
/**
37
* The URL of the action, for example https://airbnbforcats.com/magic/signup
38
* The email auth token (mtoken) gets added automatically to this URL.
39
*/
40
url: string;
41
/**
42
* The button text.
43
*/
44
name: string;
45
/**
46
* OPTIONAL
47
* The "purpose" of the action. Use a short value to describe what the token should be valid for,
48
* such as "signup" or "login".
49
*
50
* When you verify the token you can verify this expected purpose to ensure somebody isn't using a token
51
* for an unintended purpose.
52
*
53
* Default to an empty string.
54
*/
55
purpose?: string;
56
/**
57
* You can specify some user data to associate with the email auth token that will be returned
58
* when you verify this token. You could add information about the user here (e.g. their user ID).
59
*
60
* Must be a string, up to 2KB in size, which should be large enough for a small JSON object.
61
*/
62
user_data?: string;
63
/**
64
* OPTIONAL
65
* How long the action's token should be valid for in seconds.
66
*
67
* Defaults to 1800 seconds (=30 minutes), and can be at most 14 days.
68
*/
69
expiry_in_seconds?: number;
70
}
71
/**
72
* OPTIONAL
73
* The content shown below the action.
74
*
75
* Markdown enabled.
76
*/
77
outro?: string;
78
/**
79
* OPTIONAL
80
* Content that is shown just below the main e-mail content, usually here you would put extra help text for the user.
81
* Such as: "If you don't want to log in, you can safely ignore this e-mail", or "You are receiving this e-mail because
82
* someone ...".
83
*
84
* Markdown enabled.
85
*/
86
sub?: string;
87
/**
88
* OPTIONAL
89
* Shown at the very bottom of the e-mail.
90
*
91
* This is a good place to put your company name and address, as well as links to your terms of service and privacy policy.
92
*
93
* Markdown enabled.
94
*/
95
footer?: string;
96
}
97
​
Copied!

TemplateStyle

This object allows you to customize the e-mail's styling somewhat.
1
interface EmailTemplateStyleOptions {
2
/**
3
* OPTIONAL
4
* The color of buttons in your e-mail.
5
* For maximum compatability use a hex color such as "#FAEECC".
6
*
7
* Defaults to a dark blue color.
8
*/
9
button_color?: string,
10
/**
11
* OPTIONAL
12
* Whether to use a custom font.
13
*
14
* Custom fonts in e-mails have to be loaded from a third party (usually Google Fonts), which means they are not great for your user's privacy.
15
*
16
* Defaults to `true`.
17
*/
18
custom_font?: boolean,
19
/**
20
* OPTIONAL
21
* Whether to offer dark mode support.
22
*
23
* Defaults to `true`.
24
*/
25
dark_mode?: boolean,
26
}
Copied!
Last modified 11mo ago