mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
refactor
This commit is contained in:
parent
13513c913c
commit
5b2d5421c2
@ -21,8 +21,8 @@ export async function sendEmail(to: string, subject: string, html: string, text:
|
|||||||
proxy: config.proxySmtp,
|
proxy: config.proxySmtp,
|
||||||
auth: enableAuth ? {
|
auth: enableAuth ? {
|
||||||
user: meta.smtpUser,
|
user: meta.smtpUser,
|
||||||
pass: meta.smtpPass
|
pass: meta.smtpPass,
|
||||||
} : undefined
|
} : undefined,
|
||||||
} as any);
|
} as any);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -33,86 +33,85 @@ export async function sendEmail(to: string, subject: string, html: string, text:
|
|||||||
subject: subject,
|
subject: subject,
|
||||||
text: text,
|
text: text,
|
||||||
html: `<!doctype html>
|
html: `<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<title>${ subject }</title>
|
<title>${ subject }</title>
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
background: #eee;
|
background: #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font-family: sans-serif;
|
font-family: sans-serif;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #86b300;
|
color: #86b300;
|
||||||
}
|
}
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
main {
|
main {
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
color: #555;
|
color: #555;
|
||||||
}
|
}
|
||||||
main > header {
|
main > header {
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
background: #86b300;
|
background: #86b300;
|
||||||
}
|
}
|
||||||
main > header > img {
|
main > header > img {
|
||||||
max-width: 128px;
|
max-width: 128px;
|
||||||
max-height: 28px;
|
max-height: 28px;
|
||||||
vertical-align: bottom;
|
vertical-align: bottom;
|
||||||
}
|
}
|
||||||
main > article {
|
main > article {
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
}
|
}
|
||||||
main > article > h1 {
|
main > article > h1 {
|
||||||
margin: 0 0 1em 0;
|
margin: 0 0 1em 0;
|
||||||
}
|
}
|
||||||
main > footer {
|
main > footer {
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
border-top: solid 1px #eee;
|
border-top: solid 1px #eee;
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
max-width: 500px;
|
max-width: 500px;
|
||||||
margin: 16px auto 0 auto;
|
margin: 16px auto 0 auto;
|
||||||
padding: 0 32px;
|
padding: 0 32px;
|
||||||
}
|
}
|
||||||
nav > a {
|
nav > a {
|
||||||
color: #888;
|
color: #888;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<main>
|
||||||
<header>
|
<header>
|
||||||
<img src="${ meta.logoImageUrl || meta.iconUrl || iconUrl }"/>
|
<img src="${ meta.logoImageUrl || meta.iconUrl || iconUrl }"/>
|
||||||
</header>
|
</header>
|
||||||
<article>
|
<article>
|
||||||
<h1>${ subject }</h1>
|
<h1>${ subject }</h1>
|
||||||
<div>${ html }</div>
|
<div>${ html }</div>
|
||||||
</article>
|
</article>
|
||||||
<footer>
|
<footer>
|
||||||
<a href="${ emailSettingUrl }">${ 'Email setting' }</a>
|
<a href="${ emailSettingUrl }">${ 'Email setting' }</a>
|
||||||
</footer>
|
</footer>
|
||||||
</main>
|
</main>
|
||||||
<nav>
|
<nav>
|
||||||
<a href="${ config.url }">${ config.host }</a>
|
<a href="${ config.url }">${ config.host }</a>
|
||||||
</nav>
|
</nav>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>`,
|
||||||
`
|
|
||||||
});
|
});
|
||||||
|
|
||||||
logger.info('Message sent: %s', info.messageId);
|
logger.info('Message sent: %s', info.messageId);
|
||||||
|
Loading…
Reference in New Issue
Block a user