Skip to content

Commit

Permalink
Testing email notification
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsinht committed May 14, 2020
1 parent 808cbad commit 2b07392
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
10 changes: 6 additions & 4 deletions emails/generic_email.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = (fname, lname, email, text) => {
module.exports = (subject, fname, lname, email, text) => {
return (
`
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background: #f5f8fa; min-width: 350px; font-size: 1px; line-height: normal;">
Expand Down Expand Up @@ -38,7 +38,9 @@ module.exports = (fname, lname, email, text) => {
<tr>
<td align="left" valign="top">
<font face="'Source Sans Pro', sans-serif" color="#1a1a1a" style="font-size: 52px; line-height: 54px; font-weight: 300; letter-spacing: -1.5px;">
<span style="font-family: 'Source Sans Pro', Arial, Tahoma, Geneva, sans-serif; color: #1a1a1a; font-size: 30px; line-height: 54px; font-weight: 300; letter-spacing: -1.5px;">Verify your email address</span>
<span style="font-family: 'Source Sans Pro', Arial, Tahoma, Geneva, sans-serif; color: #1a1a1a; font-size: 30px; line-height: 54px; font-weight: 300; letter-spacing: -1.5px;">` +
subject +
`</span>
</font>
<div style="height: 21px; line-height: 21px; font-size: 19px;">&nbsp;</div>
<font face="'Source Sans Pro', sans-serif" color="#000000" style="font-size: 20px; line-height: 28px;">
Expand All @@ -64,8 +66,8 @@ module.exports = (fname, lname, email, text) => {
<tr>
<td align="center" valign="top">
<a href="https://www.taskbarter.com/"
target="_blank" style="display: block; border: 1px solid #433881; border-radius: 4px; padding: 19px 27px; font-family: 'Source Sans Pro', Arial, Verdana, Tahoma, Geneva, sans-serif; color: #ffffff; font-size: 26px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;"> <font face="'Source Sans Pro', sans-serif" color="#ffffff" style="font-size: 26px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;">
<span style="font-family: 'Source Sans Pro', Arial, Verdana, Tahoma, Geneva, sans-serif; color: #ffffff; font-size: 26px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;">View Now</span>
target="_blank" style="display: block; border: 1px solid #433881; border-radius: 4px; padding: 19px 27px; font-family: 'Source Sans Pro', Arial, Verdana, Tahoma, Geneva, sans-serif; color: #ffffff; font-size: 26px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;"> <font face="'Source Sans Pro', sans-serif" color="#ffffff" style="font-size: 18px; line-height: 25px; text-decoration: none; white-space: nowrap; font-weight: 400;">
<span style="font-family: 'Source Sans Pro', Arial, Verdana, Tahoma, Geneva, sans-serif; color: #ffffff; font-size: 18px; line-height: 25px; text-decoration: none; white-space: nowrap; font-weight: 400;">View Now</span>
</font>
</a>
</td>
Expand Down
4 changes: 3 additions & 1 deletion functions/sendEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ const sendEmailUsingNode = async (subject, to_email, text, fname, lname) => {
to: to_email,
subject: 'Taskbarter | ' + subject,
text: text,
html: generic_template(fname, lname, to_email, text),
html: generic_template(subject, fname, lname, to_email, text),
};

console.log('sending email to ' + to_email);

transporter.sendMail(mailOptions, function (error, info) {
if (error) {
console.log(error);
Expand Down
4 changes: 2 additions & 2 deletions routes/api/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ router.post('/sendproposal', auth, async (req, res) => {

//SENDING EMAIL NOTIFICATION:
const task_owner_user = await User.findById(ptask.user);
const task_owner_prof = await PersonalDetails.find({ user: ptask.user });
const task_owner_prof = await PersonalDetails.findOne({ user: ptask.user });
sendEmailUsingNode(
'New Proposal',
task_owner_user.email,
Expand Down Expand Up @@ -912,7 +912,7 @@ router.post(

//SENDING EMAIL NOTIFICATION:
const task_receiver_user = await User.findById(pros.user);
const task_receiver_prof = await PersonalDetails.find({
const task_receiver_prof = await PersonalDetails.findOne({
user: pros.user,
});
sendEmailUsingNode(
Expand Down

0 comments on commit 2b07392

Please sign in to comment.