Fixed some issues with email spam scores

This commit is contained in:
Sagi Dayan 2020-05-13 21:59:40 -04:00
parent 8013fb5343
commit ff7349f506
11 changed files with 545 additions and 566 deletions

View File

@ -24,6 +24,9 @@ class AdminApiController {
code: 0, data: {}
}
}
return {
code: 500, message: 'Something went wrong'
}
} catch (e) {
response.code(500);

View File

@ -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) => {
message.from(from).to(to).subject('Seepur | Email Settings Test');
});
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) => {
message.from(from).to(to).subject('Welcome to your Seepur');
});
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;
}
}

View File

@ -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'}
},
/*

View File

@ -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",

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

View File

@ -1,29 +1,40 @@
<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;
background-image: url('{{baseUrl}}/images/emails/cloudgroup.png');
background-size: cover;
background-position: center center;">
<h1>Seepur</h1>
</div>
@!section('content')
<footer style="background-color: #fafafa; padding: 3rem 1.5rem 6rem; margin-top:2rem">
<div style="text-align: center !important;">
<p>
<strong>Seepur</strong> | The source code is licensed
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. Made with ♥️ by friends and family. For all the savtot out there
</p>
<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;
background-image: url('{{baseUrl}}/images/emails/cloudgroup.png');
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>
</footer>
@!section('content')
<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
<a href="http://opensource.org/licenses/mit-license.php">MIT</a>. Made with ♥️ by friends and family. For all the savtot out there
</p>
</div>
</footer>
</div>
</div>
</div>
</html>

View 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!

View 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

View File

@ -1,46 +1,54 @@
@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>
Hi {{user.name}},
</h4>
<h4>
Hi {{user.name}},
</h4>
<p>
Welcome to your very own Seepur!
<p>
<p>
Thank you for choosing us to help you connect with your far away loved ones!
</p>
<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%">
<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;
cursor: pointer;
justify-content: center;
padding-bottom: calc(0.5em - 1px);
padding-left: 1em;
padding-right: 1em;
padding-top: calc(0.5em - 1px);
text-align: center;
white-space: nowrap;
border-radius: 290486px;
padding-left: calc(1em + 0.25em);
padding-right: calc(1em + 0.25em);
display: inline-block;
text-decoration: none;
" href="{{baseUrl}}" target="_blank">Take me to Seepur</a>
</div>
<p>
Have a great time,
</p>
<br>
<p>
Team Seepur
</p>
</div>
<p>
Welcome to your very own Seepur!
<p>
<p>
Thank you for choosing us to help you connect with your far away loved ones!
</p>
<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;
cursor: pointer;
justify-content: center;
padding-bottom: calc(0.5em - 1px);
padding-left: 1em;
padding-right: 1em;
padding-top: calc(0.5em - 1px);
text-align: center;
white-space: nowrap;
border-radius: 290486px;
padding-left: calc(1em + 0.25em);
padding-right: calc(1em + 0.25em);
display: inline-block;
text-decoration: none;
" href="{{baseUrl}}" target="_blank">Take me to Seepur</a>
</div>
<p>
We Hope you will have a great time
</p>
<br>
<p>
Team Seepur
</p>
@endsection

887
yarn.lock

File diff suppressed because it is too large Load Diff