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: {}
|
code: 0, data: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return {
|
||||||
|
code: 500, message: 'Something went wrong'
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
response.code(500);
|
response.code(500);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
const Mail = use('Mail');
|
const Mail = use('Mail');
|
||||||
const Env = use('Env');
|
const Env = use('Env');
|
||||||
|
const Logger = use('Logger')
|
||||||
|
|
||||||
const from = Env.get('MAIL_FROM', 'admin@localhost.com');
|
const from = Env.get('MAIL_FROM', 'admin@localhost.com');
|
||||||
const baseUrl = Env.get('APP_URL', 'http://localhost:3333');
|
const baseUrl = Env.get('APP_URL', 'http://localhost:3333');
|
||||||
|
@ -10,22 +11,26 @@ class EmailUtils {
|
||||||
static async sendTestEmail(user) {
|
static async sendTestEmail(user) {
|
||||||
const to = user.email;
|
const to = user.email;
|
||||||
try {
|
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');
|
message.from(from).to(to).subject('Seepur | Email Settings Test');
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
Logger.error(e);
|
||||||
throw 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;
|
if (!emailEnabled) return true;
|
||||||
const to = user.email;
|
const to = user.email;
|
||||||
const link = {
|
const link = {
|
||||||
href: `${appUrl}/password/reset/${code}`,
|
href: `${appUrl}/password/reset/${code}`,
|
||||||
text: 'Reset your password'
|
text: 'Reset your password'
|
||||||
};
|
};
|
||||||
|
Logger.info(`Sending test email to ${user.email}`);
|
||||||
try {
|
try {
|
||||||
await Mail.send(
|
await Mail.send(
|
||||||
'emails.reset-password', {user, code, link, baseUrl}, (message) => {
|
'emails.reset-password', {user, code, link, baseUrl}, (message) => {
|
||||||
|
@ -33,7 +38,7 @@ class EmailUtils {
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
Logger.error(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,14 +46,16 @@ class EmailUtils {
|
||||||
static async sendWelcomeEmail(user) {
|
static async sendWelcomeEmail(user) {
|
||||||
if (!emailEnabled) return true;
|
if (!emailEnabled) return true;
|
||||||
const to = user.email;
|
const to = user.email;
|
||||||
console.log(`Sending welcome email to:${to} from:${from}`);
|
Logger.info(`Sending welcome email to:${to} from:${from}`);
|
||||||
try {
|
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');
|
message.from(from).to(to).subject('Welcome to your Seepur');
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
Logger.error(e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,11 +199,7 @@ module.exports = {
|
||||||
| and `stderr`
|
| and `stderr`
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
console: {
|
console: {driver: 'console', name: 'Seepur', level: 'info'},
|
||||||
driver: 'console',
|
|
||||||
name: 'adonis-app',
|
|
||||||
level: 'info'
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -216,12 +212,8 @@ module.exports = {
|
||||||
| For a different directory, set an absolute path for the filename.
|
| For a different directory, set an absolute path for the filename.
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
file: {
|
file:
|
||||||
driver: 'file',
|
{driver: 'file', name: 'Seepur', filename: 'adonis.log', level: 'info'}
|
||||||
name: 'adonis-app',
|
|
||||||
filename: 'adonis.log',
|
|
||||||
level: 'info'
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
10
package.json
10
package.json
|
@ -39,15 +39,15 @@
|
||||||
"@adonisjs/websocket": "^1.0.12",
|
"@adonisjs/websocket": "^1.0.12",
|
||||||
"@adonisjs/websocket-client": "^1.0.9",
|
"@adonisjs/websocket-client": "^1.0.9",
|
||||||
"adonis-vue-websocket": "^2.0.2",
|
"adonis-vue-websocket": "^2.0.2",
|
||||||
"animate.css": "^3.7.2",
|
"animate.css": "^4.1.0",
|
||||||
"bulma": "^0.8.0",
|
"bulma": "^0.8.0",
|
||||||
"fork-awesome": "^1.1.7",
|
"fork-awesome": "^1.1.7",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"regenerator-runtime": "^0.13.5",
|
"regenerator-runtime": "^0.13.5",
|
||||||
"rematrix": "^0.5.0",
|
"rematrix": "^0.7.0",
|
||||||
"sqlite3": "^4.1.1",
|
"sqlite3": "^4.1.1",
|
||||||
"typescript": "^3.7.5",
|
"typescript": "^3.7.5",
|
||||||
"uuid": "^7.0.3",
|
"uuid": "^8.0.0",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
"vue-router": "^3.1.5",
|
"vue-router": "^3.1.5",
|
||||||
"vuex": "^3.1.2"
|
"vuex": "^3.1.2"
|
||||||
|
@ -56,13 +56,13 @@
|
||||||
"@babel/core": "^7.8.3",
|
"@babel/core": "^7.8.3",
|
||||||
"@babel/plugin-transform-regenerator": "^7.8.7",
|
"@babel/plugin-transform-regenerator": "^7.8.7",
|
||||||
"@babel/plugin-transform-runtime": "^7.9.0",
|
"@babel/plugin-transform-runtime": "^7.9.0",
|
||||||
"@types/node": "^13.11.0",
|
"@types/node": "^14.0.1",
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
"babel-preset-env": "^1.7.0",
|
"babel-preset-env": "^1.7.0",
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
"babel-preset-stage-2": "^6.24.1",
|
||||||
"css-loader": "^3.4.2",
|
"css-loader": "^3.4.2",
|
||||||
"node-sass": "^4.13.0",
|
"node-sass": "^4.13.0",
|
||||||
"ts-loader": "^6.2.1",
|
"ts-loader": "^7.0.4",
|
||||||
"vue-loader": "^15.8.3",
|
"vue-loader": "^15.8.3",
|
||||||
"vue-style-loader": "^4.1.2",
|
"vue-style-loader": "^4.1.2",
|
||||||
"vue-template-compiler": "^2.6.11",
|
"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,3 +1,5 @@
|
||||||
|
|
||||||
|
<html>
|
||||||
<div style="width:100%">
|
<div style="width:100%">
|
||||||
<div style="color: #4a4a4a;
|
<div style="color: #4a4a4a;
|
||||||
max-width:800px;
|
max-width:800px;
|
||||||
|
@ -11,11 +13,19 @@
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center center;">
|
background-position: center center;">
|
||||||
<h1>Seepur</h1>
|
<h1>Seepur</h1>
|
||||||
|
<h4>A <b>safe</b> and <b>fun</b> way to spend time with far away loved ones</h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@!section('content')
|
@!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;">
|
<div style="text-align: center !important;">
|
||||||
<p>
|
<p>
|
||||||
<strong>Seepur</strong> | The source code is licensed
|
<strong>Seepur</strong> | The source code is licensed
|
||||||
|
@ -27,3 +37,4 @@
|
||||||
</div>
|
</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,14 +1,14 @@
|
||||||
@layout('emails.layouts.base')
|
@layout('emails.layouts.base')
|
||||||
|
|
||||||
@section('content')
|
@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}},
|
Hi {{user.name}},
|
||||||
</h4>
|
</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>
|
<p>
|
||||||
Welcome to your very own Seepur!
|
Welcome to your very own Seepur!
|
||||||
<p>
|
<p>
|
||||||
|
@ -16,6 +16,13 @@
|
||||||
Thank you for choosing us to help you connect with your far away loved ones!
|
Thank you for choosing us to help you connect with your far away loved ones!
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<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;">
|
<div style="width: 100%; display:flex;justify-content: center;">
|
||||||
<a style="margin-right:auto; margin-left:auto;background-color: white;
|
<a style="margin-right:auto; margin-left:auto;background-color: white;
|
||||||
border:solid 1px #dbdbdb;
|
border:solid 1px #dbdbdb;
|
||||||
|
@ -37,10 +44,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
We Hope you will have a great time
|
Have a great time,
|
||||||
</p>
|
</p>
|
||||||
<br>
|
<br>
|
||||||
<p>
|
<p>
|
||||||
Team Seepur
|
Team Seepur
|
||||||
</p>
|
</p>
|
||||||
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
Reference in a new issue