generated from WildCodeSchool/create-js-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from WildCodeSchool/remove-extra-files
Remove extra files
- Loading branch information
Showing
32 changed files
with
674 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,75 @@ class ActivationManager { | |
} | ||
}); | ||
} | ||
|
||
static sendMail(sender, firstname, lastname, title, text) { | ||
const transporter = createTransport({ | ||
host: process.env.NODE_HOST, | ||
port: process.env.NODE_PORT, | ||
auth: { | ||
user: process.env.NODE_USER, | ||
pass: process.env.NODE_MAILER_KEY, | ||
}, | ||
}); | ||
const mailOptions = { | ||
from: process.env.NODE_USER, | ||
to: "[email protected]", | ||
subject: "Fiche contact, la Banque de tutos", | ||
text: "", | ||
html: ` | ||
<h3> Title : ${title}</h3> | ||
<h3> Sender : ${firstname} ${lastname} (${sender})</h3> | ||
<h3> Message</h3> | ||
<pre>${text}</pre> | ||
`, | ||
}; | ||
transporter.sendMail(mailOptions, (error, info) => { | ||
if (error) { | ||
console.error(error); | ||
return false; | ||
} | ||
console.error("Email sent: ", info.response); | ||
return true; | ||
}); | ||
} | ||
|
||
static autoAnswerMail(sender, firstname, title, text) { | ||
const transporter = createTransport({ | ||
host: process.env.NODE_HOST, | ||
port: process.env.NODE_PORT, | ||
auth: { | ||
user: process.env.NODE_USER, | ||
pass: process.env.NODE_MAILER_KEY, | ||
}, | ||
}); | ||
const lien = `${process.env.FRONTEND_URL}`; | ||
const mailOptions = { | ||
from: process.env.NODE_USER, | ||
to: sender, | ||
subject: "Message reçu, de la part de la Banque de tutos", | ||
text: "", | ||
html: ` | ||
<h2>Bonjour ${firstname}, </h2> | ||
<p>La banque de tutos vous remercie pour votre message. Veuillez noter que nous avons bien reçu votre e-mail. </p> | ||
<p>Nos administrateurs s'efforcent de répondre dans les plus brefs délais. Nous vous remercions de votre patience et de votre compréhension.</p> | ||
<p>Cordialement</p> | ||
<a href="${lien}">${lien}</a> | ||
<h3> Message</h3> | ||
<h3> Title : ${title}</h3> | ||
<h3> Sender : ${sender}</h3> | ||
<pre>${text}</pre> | ||
`, | ||
}; | ||
transporter.sendMail(mailOptions, (error, info) => { | ||
if (error) { | ||
console.error(error); | ||
} else { | ||
console.error("Email sent: ", info.response); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
module.exports = ActivationManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.