diff --git a/pages/cart/publishers/myschedule.tsx b/pages/cart/publishers/myschedule.tsx
index f5ee2b4..f6962a1 100644
--- a/pages/cart/publishers/myschedule.tsx
+++ b/pages/cart/publishers/myschedule.tsx
@@ -26,19 +26,15 @@ export default function MySchedulePage({ assignments }) {
const [newPublisher, setNewPublisher] = useState(null);
const { data: session, status } = useSession();
+
+ // temporary alert for the users
+ useEffect(() => {
+ alert("Мили братя, искаме само да ви напомним да ни изпратите вашите предпочитания за юни до 25-то число като използвате меню 'Възможности'. Ако имате проблем, моля пишете ни на 'specialnosvidetelstvanesofia@gmail.com'");
+ }, []);
+
if (status === "loading") {
- return
Loading...
;
+ return Зареждане...
;
}
- // temporary alert for the users
- useEffect(() => {
- alert("Мили братя, искаме само да ви напомним да ни изпратите вашите предпочитания за юни до 25-то число като използвате меню 'Възможности'. Ако имате проблем, моля пишете ни на 'specialnosvidetelstvanesofia@gmail.com'");
- }, []);
-
-
- // temporary alert for the users
- useEffect(() => {
- alert("Мили братя, искаме само да ви напомним да ни изпратите вашите предпочитания за юни до 25-то число като използвате меню 'Възможности'. Ако имате проблем, моля пишете ни на 'specialnosvidetelstvanesofia@gmail.com'");
- }, []);
const handleReplaceInAssignment = () => {
diff --git a/src/helpers/email.js b/src/helpers/email.js
index 93c912c..402f82d 100644
--- a/src/helpers/email.js
+++ b/src/helpers/email.js
@@ -24,7 +24,11 @@ if (process.env.EMAIL_SERVICE.toLowerCase() === "mailtrap") {
auth: {
user: process.env.MAILTRAP_USER,
pass: process.env.MAILTRAP_PASS
- }
+ },
+ pool: true, // use pooled connection
+ rateLimit: true, // enable to make sure we are limiting
+ maxConnections: 1, // set limit to 1 connection only
+ maxMessages: 2 // send 2 emails per second
});
}
else if (process.env.EMAIL_SERVICE.toLowerCase() === "gmail") {
@@ -70,16 +74,19 @@ function normalizeEmailAddresses(to) {
return emails; // Always returns an array
}
-///
-/// Final email sending function.
-///
-/// Email address or array of email addresses
-/// Email subject
-/// Plain text version of the email
-/// HTML version of the email
-/// Array of attachment objects
-/// Promise
+
+
+/**
+ * Final email sending function.
+ *
+ * @param {string|string[]} to - Email address or array of email addresses.
+ * @param {string} subject - Email subject.
+ * @param {string} text - Plain text version of the email.
+ * @param {string} html - HTML version of the email.
+ * @param {Object[]} [attachments=[]] - Array of attachment objects.
+ * @returns {Promise} - A promise that resolves when the email is sent.
+ */
exports.SendEmail = async function (to, subject, text, html, attachments = []) {
let sender = process.env.EMAIL_SENDER || '"Специално Свидетелстване София" ';
let emailAddresses = normalizeEmailAddresses(to)
@@ -103,6 +110,7 @@ exports.SendEmail = async function (to, subject, text, html, attachments = []) {
.sendMail(message)
.then(console.log)
.catch(console.error);
+
return result;
};
@@ -148,6 +156,7 @@ exports.SendEmailHandlebars = async function (to, templateName, model, attachmen
} catch (error) {
console.error(error);
+ Handlebars.logger.error(error);
return new Error('Error sending email');
}
};