diff --git a/app/api/utils/email/send.js b/app/api/utils/email/send.js index 9d24e1e..76a4e1d 100644 --- a/app/api/utils/email/send.js +++ b/app/api/utils/email/send.js @@ -38,6 +38,11 @@ const sendDailyEmail = async ({ subscribers } = {}) => { const randomVerse = getRandomItemFromArray(verses) const stringifiedEmails = subscribers.map(subscriber => subscriber.email).join(", ") + const shareText = `الآية ${randomVerse.ayah} من سورة ${randomVerse.sora.trim()} +%0A{ ${randomVerse.content.trim()} }%0A%0A +للمزيد قم بزيارة الرابط التالي: +%0A${encodeURI("https://quran-mailer.vercel.app")}` + const html = `

{ ${randomVerse.content}

+

+ شارك هذه الآية عبر المنصات التالية ولك أجرٌ على كل من يقرأها بإذن الله. +

+
+ + WhatsApp Icon + + + Telegram Icon + + + Twitter Icon + +
${randomVerse.tafseer ? `

{

` - return sendEmail({ to: stringifiedEmails, subject: "Daily Quran Verse", html }) + const attachments = [ + { + filename: "whatsapp.png", + path: "./public/social-icons/whatsapp.png", + cid: "01" + }, + { + filename: "telegram.png", + path: "./public/social-icons/telegram.png", + cid: "02" + }, + { + filename: "twitter.png", + path: "./public/social-icons/twitter.png", + cid: "03" + }, + ] + + return sendEmail({ to: stringifiedEmails, subject: "Daily Quran Verse", html, attachments }) } export { sendContactEmail, sendVerificationEmail, sendDailyEmail } diff --git a/app/api/utils/email/utils.js b/app/api/utils/email/utils.js index 243cb77..04b475b 100644 --- a/app/api/utils/email/utils.js +++ b/app/api/utils/email/utils.js @@ -1,10 +1,11 @@ -const sendEmail = async ({ to = process.env.GMAIL_USER, subject, html } = {}) => { +const sendEmail = async ({ to = process.env.GMAIL_USER, subject, html, attachments } = {}) => { const mailTransporter = require('../../../../lib/nodemailer'); const mailOptions = { from: process.env.GMAIL_USER, to, subject, - html + html, + attachments } return new Promise((resolve, reject) => { diff --git a/public/social-icons/telegram.png b/public/social-icons/telegram.png new file mode 100644 index 0000000..696e521 Binary files /dev/null and b/public/social-icons/telegram.png differ diff --git a/public/social-icons/twitter.png b/public/social-icons/twitter.png new file mode 100644 index 0000000..d4a2760 Binary files /dev/null and b/public/social-icons/twitter.png differ diff --git a/public/social-icons/whatsapp.png b/public/social-icons/whatsapp.png new file mode 100644 index 0000000..2a559d8 Binary files /dev/null and b/public/social-icons/whatsapp.png differ