diff --git a/UTILS/PutOrders/puo_sendmail.js b/UTILS/PutOrders/puo_sendmail.js index 9a053f06c5..942a8a63cf 100644 --- a/UTILS/PutOrders/puo_sendmail.js +++ b/UTILS/PutOrders/puo_sendmail.js @@ -156,9 +156,15 @@ function sendMail( p_mailfrom while (startPos > 4 && eindPos > startPos) { var flexcode = p_bodyhtml.substring(startPos + 1, eindPos); + if (flexcode.indexOf("M=") < 0) + { + Log2File(1, " found in XML but invalid. Ignored: " + flexcode); + break; + } if (!S("puo_fclt_web_url") || !S("puo_fclt_web_apikey")) { - throw { description: " found in XML but puo_fclt_web_url or puo_fclt_web_apikey not set" }; + Log2File(1, " found in XML but puo_fclt_web_url or puo_fclt_web_apikey not set. Ignored: " + flexcode); + break; } // om te voorkomen dat je elke klant in de hosts file moet opnemen wordt @@ -211,12 +217,18 @@ function sendMail( p_mailfrom var logoPathName = custabspath + "/" + logoFileName; Log2File(2, logoFileName); Log2File(2, "After bodyHTML"); - objMail.addRelatedBodyPart(logoPathName, logoFileName, 0); + try { + objMail.addRelatedBodyPart(logoPathName, logoFileName, 0); + } + catch (e) + { + throw new UserException(e + 1000, "PutOrders", e.description + "\nPerhaps invalid logo path: "+ logoPathName); + } } } catch(e) { - throw new UserException(e + 1000, "PutOrders", e.description + "\nPerhaps invalid logo path: "+ logoPathName); + throw new UserException(e + 1000, "PutOrders", e.description); } }