forked from sagi/seepur
Fixed some issues with email spam scores
This commit is contained in:
parent
8013fb5343
commit
ff7349f506
11 changed files with 545 additions and 566 deletions
|
@ -24,6 +24,9 @@ class AdminApiController {
|
|||
code: 0, data: {}
|
||||
}
|
||||
}
|
||||
return {
|
||||
code: 500, message: 'Something went wrong'
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
response.code(500);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
const Mail = use('Mail');
|
||||
const Env = use('Env');
|
||||
const Logger = use('Logger')
|
||||
|
||||
const from = Env.get('MAIL_FROM', 'admin@localhost.com');
|
||||
const baseUrl = Env.get('APP_URL', 'http://localhost:3333');
|
||||
|
@ -10,22 +11,26 @@ class EmailUtils {
|
|||
static async sendTestEmail(user) {
|
||||
const to = user.email;
|
||||
try {
|
||||
await Mail.send('emails.test-settings', {user, baseUrl}, (message) => {
|
||||
await Mail.send(
|
||||
['emails.test-settings', 'emails.test-settings-text'],
|
||||
{user, baseUrl}, (message) => {
|
||||
message.from(from).to(to).subject('Seepur | Email Settings Test');
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
throw e;
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
static async sendResetPassword(user, code) {
|
||||
static async sendResetPassword(
|
||||
user, code) { // TODO: Make a text version of this email
|
||||
if (!emailEnabled) return true;
|
||||
const to = user.email;
|
||||
const link = {
|
||||
href: `${appUrl}/password/reset/${code}`,
|
||||
text: 'Reset your password'
|
||||
};
|
||||
Logger.info(`Sending test email to ${user.email}`);
|
||||
try {
|
||||
await Mail.send(
|
||||
'emails.reset-password', {user, code, link, baseUrl}, (message) => {
|
||||
|
@ -33,7 +38,7 @@ class EmailUtils {
|
|||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -41,14 +46,16 @@ class EmailUtils {
|
|||
static async sendWelcomeEmail(user) {
|
||||
if (!emailEnabled) return true;
|
||||
const to = user.email;
|
||||
console.log(`Sending welcome email to:${to} from:${from}`);
|
||||
Logger.info(`Sending welcome email to:${to} from:${from}`);
|
||||
try {
|
||||
await Mail.send('emails.welcome', {user, baseUrl}, (message) => {
|
||||
await Mail.send(
|
||||
['emails.welcome', 'emails.welcome-text'], {user, baseUrl},
|
||||
(message) => {
|
||||
message.from(from).to(to).subject('Welcome to your Seepur');
|
||||
});
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
Logger.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,11 +199,7 @@ module.exports = {
|
|||
| and `stderr`
|
||||
|
|
||||
*/
|
||||
console: {
|
||||
driver: 'console',
|
||||
name: 'adonis-app',
|
||||
level: 'info'
|
||||
},
|
||||
console: {driver: 'console', name: 'Seepur', level: 'info'},
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -216,12 +212,8 @@ module.exports = {
|
|||
| For a different directory, set an absolute path for the filename.
|
||||
|
|
||||
*/
|
||||
file: {
|
||||
driver: 'file',
|
||||
name: 'adonis-app',
|
||||
filename: 'adonis.log',
|
||||
level: 'info'
|
||||
}
|
||||
file:
|
||||
{driver: 'file', name: 'Seepur', filename: 'adonis.log', level: 'info'}
|
||||
},
|
||||
|
||||
/*
|
||||
|
|
10
package.json
10
package.json
|
@ -39,15 +39,15 @@
|
|||
"@adonisjs/websocket": "^1.0.12",
|
||||
"@adonisjs/websocket-client": "^1.0.9",
|
||||
"adonis-vue-websocket": "^2.0.2",
|
||||
"animate.css": "^3.7.2",
|
||||
"animate.css": "^4.1.0",
|
||||
"bulma": "^0.8.0",
|
||||
"fork-awesome": "^1.1.7",
|
||||
"moment": "^2.24.0",
|
||||
"regenerator-runtime": "^0.13.5",
|
||||
"rematrix": "^0.5.0",
|
||||
"rematrix": "^0.7.0",
|
||||
"sqlite3": "^4.1.1",
|
||||
"typescript": "^3.7.5",
|
||||
"uuid": "^7.0.3",
|
||||
"uuid": "^8.0.0",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.1.5",
|
||||
"vuex": "^3.1.2"
|
||||
|
@ -56,13 +56,13 @@
|
|||
"@babel/core": "^7.8.3",
|
||||
"@babel/plugin-transform-regenerator": "^7.8.7",
|
||||
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||
"@types/node": "^13.11.0",
|
||||
"@types/node": "^14.0.1",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-preset-env": "^1.7.0",
|
||||
"babel-preset-stage-2": "^6.24.1",
|
||||
"css-loader": "^3.4.2",
|
||||
"node-sass": "^4.13.0",
|
||||
"ts-loader": "^6.2.1",
|
||||
"ts-loader": "^7.0.4",
|
||||
"vue-loader": "^15.8.3",
|
||||
"vue-style-loader": "^4.1.2",
|
||||
"vue-template-compiler": "^2.6.11",
|
||||
|
|
BIN
public/images/emails/sun+cloud.png
Normal file
BIN
public/images/emails/sun+cloud.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 27 KiB |
|
@ -1,9 +1,11 @@
|
|||
<div style="width:100%">
|
||||
|
||||
<html>
|
||||
<div style="width:100%">
|
||||
<div style="color: #4a4a4a;
|
||||
max-width:800px;
|
||||
margin-left:auto;
|
||||
margin-right:auto;
|
||||
">
|
||||
">
|
||||
<div style="background-color: #fafafa;
|
||||
padding: 2rem 1.5rem 2rem;
|
||||
margin-bottom:2rem;
|
||||
|
@ -11,11 +13,19 @@
|
|||
background-size: cover;
|
||||
background-position: center center;">
|
||||
<h1>Seepur</h1>
|
||||
<h4>A <b>safe</b> and <b>fun</b> way to spend time with far away loved ones</h4>
|
||||
</div>
|
||||
|
||||
@!section('content')
|
||||
|
||||
<footer style="background-color: #fafafa; padding: 3rem 1.5rem 6rem; margin-top:2rem">
|
||||
<footer style="background-color: #fafafa;
|
||||
padding: 3rem 1.5rem 6rem;
|
||||
margin-top:2rem;
|
||||
background-image: url('{{baseUrl}}/images/emails/sun+cloud.png');
|
||||
background-position: center center;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
">
|
||||
<div style="text-align: center !important;">
|
||||
<p>
|
||||
<strong>Seepur</strong> | The source code is licensed
|
||||
|
@ -26,4 +36,5 @@
|
|||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
|
6
resources/views/emails/test-settings-text.edge
Normal file
6
resources/views/emails/test-settings-text.edge
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
Hi {{user.name}},
|
||||
|
||||
You've got mail!
|
||||
|
||||
If you see this email it means that your email settings are correct!
|
15
resources/views/emails/welcome-text.edge
Normal file
15
resources/views/emails/welcome-text.edge
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
Hi {{user.name}},
|
||||
Welcome to your very own Seepur!
|
||||
|
||||
Thank you for choosing us to help you connect with your far away loved ones!
|
||||
|
||||
Fun Stats on Bedtime Stories
|
||||
|
||||
* 76% of dads read to their kids compared to 72% of mums
|
||||
* 1 In 10 parents read their kids a bedtime story every night
|
||||
* 6% of parents NEVER read a bedtime story to their child
|
||||
|
||||
Have a great time,
|
||||
Team Seepur
|
||||
|
|
@ -1,22 +1,29 @@
|
|||
@layout('emails.layouts.base')
|
||||
|
||||
@section('content')
|
||||
<div style="background-image: url('{{baseUrl}}/images/emails/welcome.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
background-position: right center;">
|
||||
|
||||
<h4>
|
||||
<h4>
|
||||
Hi {{user.name}},
|
||||
</h4>
|
||||
|
||||
<div style="max-width:35%; margin: 0px auto;">
|
||||
<img src="{{baseUrl}}/images/emails/welcome.png" alt="" style="object-fit: contain; display:inline-block; margin-left:auto; margin-right:auto; max-width:100%">
|
||||
</div>
|
||||
<p>
|
||||
</h4>
|
||||
<p>
|
||||
Welcome to your very own Seepur!
|
||||
<p>
|
||||
<p>
|
||||
<p>
|
||||
<p>
|
||||
Thank you for choosing us to help you connect with your far away loved ones!
|
||||
</p>
|
||||
</p>
|
||||
|
||||
<div style="width: 100%; display:flex;justify-content: center;">
|
||||
<h4>Fun Stats on Bedtime Stories</h4>
|
||||
<ul>
|
||||
<li>76% of dads read to their kids compared to 72% of mums</li>
|
||||
<li>1 In 10 parents read their kids a bedtime story every night</li>
|
||||
<li>6% of parents NEVER read a bedtime story to their child</li>
|
||||
</ul>
|
||||
|
||||
<div style="width: 100%; display:flex;justify-content: center;">
|
||||
<a style="margin-right:auto; margin-left:auto;background-color: white;
|
||||
border:solid 1px #dbdbdb;
|
||||
color: #363636;
|
||||
|
@ -34,13 +41,14 @@
|
|||
display: inline-block;
|
||||
text-decoration: none;
|
||||
" href="{{baseUrl}}" target="_blank">Take me to Seepur</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We Hope you will have a great time
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
<p>
|
||||
Have a great time,
|
||||
</p>
|
||||
<br>
|
||||
<p>
|
||||
Team Seepur
|
||||
</p>
|
||||
</p>
|
||||
</div>
|
||||
@endsection
|
||||
|
|
Loading…
Reference in a new issue