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
|
// Check if local logo exists for CID inline attachment
|
||||||
const localLogoPath = path.join(__dirname, 'logo.png');
|
const localLogoPath = path.join(__dirname, 'logo.png');
|
||||||
const logoExists = fs.existsSync(localLogoPath);
|
const logoExists = fs.existsSync(localLogoPath);
|
||||||
// Use cid:store_logo in HTML - Gmail renders CID attachments correctly
|
// Use a remote URL if you have one, or stick to text fallback to avoid the "logo.png" attachment pill
|
||||||
const logoImgTag = logoExists
|
const logoImgTag = `<span style="font-family: Helvetica, Arial, sans-serif; font-size: 20px; font-weight: bold; color: #ffffff;">RAY AARI SHOP</span>`;
|
||||||
? `<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>`;
|
|
||||||
|
|
||||||
// --- 1. Generate Order Summary Rows HTML ---
|
// --- 1. Generate Order Summary Rows HTML ---
|
||||||
let orderRowsHtml = '';
|
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 ---
|
// --- Seller attachments: Invoice PDF only ---
|
||||||
const sellerAttachments = [
|
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 {
|
try {
|
||||||
// 1. Send to customer (Invoice only)
|
// 1. Send to customer (Invoice only)
|
||||||
const customerMail = await transporter.sendMail({
|
const customerMail = await transporter.sendMail({
|
||||||
@ -262,8 +244,8 @@ const sendEmailWithAttachment = async (toEmail, orderData, pdfBuffer, shippingLa
|
|||||||
const sellerMail = await transporter.sendMail({
|
const sellerMail = await transporter.sendMail({
|
||||||
from: `"${process.env.SHOP_NAME || 'Your Store'}" <${process.env.SMTP_FROM_EMAIL}>`,
|
from: `"${process.env.SHOP_NAME || 'Your Store'}" <${process.env.SMTP_FROM_EMAIL}>`,
|
||||||
to: sellerEmail,
|
to: sellerEmail,
|
||||||
subject: `[NEW ORDER] #${orderNumber} - Invoice & Shipping Label`,
|
subject: `[NEW ORDER] #${orderNumber} - Invoice`,
|
||||||
text: `New order #${orderNumber} received. Invoice and Shipping Label attached.`,
|
text: `New order #${orderNumber} received. Invoice attached.`,
|
||||||
html: htmlTemplate,
|
html: htmlTemplate,
|
||||||
attachments: sellerAttachments
|
attachments: sellerAttachments
|
||||||
});
|
});
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user