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.
interface EmailTemplateContent {
/**
* OPTIONAL
* The preheader is the summary text that follows a subject line when the email is viewed in an inbox.
* In many cases, it's used to provide a short summary of the email, and is typically one sentence long.
*
* NOTE: This content is not visible in the e-mail itself, only the inbox.
*/
preheader?: string;
/**
* OPTIONAL
* The URL and name of the product used in the link at the top of the e-mail.
* You should point this at the homepage of your app/website.
*
* Defaults to the Application name and URL.
*/
product?: {
url: string;
name: string;
}
/**
* OPTIONAL
* The main text content of your e-mail that appears above the action button.
*
* Markdown enabled.
*/
main?: string;
/**
* OPTIONAL
* Describes the main action button in the e-mail.
* If you don't specify the action object, there will be no button in the e-mail.
*/
action?: {
/**
* The URL of the action, for example https://airbnbforcats.com/magic/signup
* The email auth token (mtoken) gets added automatically to this URL.
*/
url: string;
/**
* The button text.
*/
name: string;
/**
* OPTIONAL
* The "purpose" of the action. Use a short value to describe what the token should be valid for,
* such as "signup" or "login".
*
* When you verify the token you can verify this expected purpose to ensure somebody isn't using a token
* for an unintended purpose.
*
* Default to an empty string.
*/
purpose?: string;
/**
* You can specify some user data to associate with the email auth token that will be returned
* when you verify this token. You could add information about the user here (e.g. their user ID).
*
* Must be a string, up to 2KB in size, which should be large enough for a small JSON object.
*/
user_data?: string;
/**
* OPTIONAL
* How long the action's token should be valid for in seconds.
*
* Defaults to 1800 seconds (=30 minutes), and can be at most 14 days.
*/
expiry_in_seconds?: number;
}
/**
* OPTIONAL
* The content shown below the action.
*
* Markdown enabled.
*/
outro?: string;
/**
* OPTIONAL
* Content that is shown just below the main e-mail content, usually here you would put extra help text for the user.
* 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
* someone ...".
*
* Markdown enabled.
*/
sub?: string;
/**
* OPTIONAL
* Shown at the very bottom of the e-mail.
*
* This is a good place to put your company name and address, as well as links to your terms of service and privacy policy.
*
* Markdown enabled.
*/
footer?: string;
}

TemplateStyle

This object allows you to customize the e-mail's styling somewhat.
interface EmailTemplateStyleOptions {
/**
* OPTIONAL
* The color of buttons in your e-mail.
* For maximum compatability use a hex color such as "#FAEECC".
*
* Defaults to a dark blue color.
*/
button_color?: string,
/**
* OPTIONAL
* Whether to use a custom font.
*
* 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.
*
* Defaults to `true`.
*/
custom_font?: boolean,
/**
* OPTIONAL
* Whether to offer dark mode support.
*
* Defaults to `true`.
*/
dark_mode?: boolean,
}