update email text and remove logo attachment
This commit is contained in:
parent
f51f2ef0b8
commit
842e9441dd
26
mailer.js
26
mailer.js
@ -30,10 +30,8 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
|
||||
// Check if local logo exists for CID inline attachment
|
||||
const localLogoPath = path.join(__dirname, 'logo.png');
|
||||
const logoExists = fs.existsSync(localLogoPath);
|
||||
// Use cid:store_logo in HTML - Gmail renders CID attachments correctly
|
||||
const logoImgTag = logoExists
|
||||
? `<img src="cid:store_logo" alt="rayaarishop" style="height: 55px; width: auto; display: block;" />`
|
||||
: `<span style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: bold; color: #ffffff;">rayaarishop</span>`;
|
||||
// Use a remote URL if you have one, or stick to text fallback to avoid the "logo.png" attachment pill
|
||||
const logoImgTag = `<span style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: bold; color: #ffffff;">RAY AARI SHOP</span>`;
|
||||
|
||||
// --- 1. Generate Order Summary Rows HTML ---
|
||||
let orderRowsHtml = '';
|
||||
@ -219,14 +217,6 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
|
||||
}
|
||||
];
|
||||
|
||||
if (logoExists) {
|
||||
customerAttachments.push({
|
||||
filename: 'logo.png',
|
||||
path: localLogoPath,
|
||||
cid: 'store_logo'
|
||||
});
|
||||
}
|
||||
|
||||
// --- Seller attachments: Invoice PDF only ---
|
||||
const sellerAttachments = [
|
||||
{
|
||||
@ -236,14 +226,6 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
|
||||
}
|
||||
];
|
||||
|
||||
if (logoExists) {
|
||||
sellerAttachments.push({
|
||||
filename: 'logo.png',
|
||||
path: localLogoPath,
|
||||
cid: 'store_logo'
|
||||
});
|
||||
}
|
||||
|
||||
try {
|
||||
// 1. Send to customer (Invoice only)
|
||||
const customerMail = await transporter.sendMail({
|
||||
@ -262,8 +244,8 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
|
||||
const sellerMail = await transporter.sendMail({
|
||||
from: `"${process.env.SHOP_NAME || 'Your Store'}" <${process.env.SMTP_FROM_EMAIL}>`,
|
||||
to: sellerEmail,
|
||||
subject: `[NEW ORDER] #${orderNumber} - Invoice & Shipping Label`,
|
||||
text: `New order #${orderNumber} received. Invoice and Shipping Label attached.`,
|
||||
subject: `[NEW ORDER] #${orderNumber} - Invoice`,
|
||||
text: `New order #${orderNumber} received. Invoice attached.`,
|
||||
html: htmlTemplate,
|
||||
attachments: sellerAttachments
|
||||
});
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user