How to make an ADF XML format be assigned to a variable without getting unxpected token error

半城伤御伤魂 提交于 2019-12-24 23:18:32

问题


I have a program where in it will send an email. I used keystone js (node) on the backend and then nunjucks on the front end. I want to send an email in ADF XML format. I wanted to assign that adf xml to bodyContent without receiving unexpected token error.That is how adf xml has to be sent and that contain dynamic data.

adf xml

<?xml version="1.0" encoding="UTF-8"?>
  <?ADF VERSION="1.0"?>
    <adf>
      <prospect>
        <id sequence="yourLeadID" source="site name"></id>
        <requestdate>2013-03-15T8:22:40</requestdate>
        <vehicle interest="buy" status="used">
        <vin>4RT6FGE6HJ78F3DF56</vin>
        <year>2013</year>
        <make>Ford</make>
        <model>Ford Focus</model&gt
        <stock>4321</stock>
        </vehicle>

      <customer>
        <contact>
        <name part="first" type="individual">John</name>
        <name part="last" type="individual">XYZ</name>
        <email>john at example.com</email>
        <phone type="home">111-222-7777</phone>
        <phone type="mobile">111-444-5555</phone>
        <phone type="work">111-222-3333</phone>
        </contact>
        <comments>Inquiry regarding vehicle</comments>
      </customer>

      <vendor>
       <contact>
       <name part="full">website name from where you are sending email</name>
       <email>john at example.com</email>
       <phone type="business">111-666-7777</phone>
       </contact>
     </vendor>
 </prospect>
</adf> 

code

var sendEmail = function (err, results) {
    if (err) return callback(err);
    async.each(results.admins, function (admin, done) {
        new keystone.Email({ templateName: 'enquiry-notification.html', transport: 'mailgun', engine: cons.nunjucks, root: 'templates/emails' }).send({

                inquiry: inquiry,
                brand: brand,
                email2: inquiry.email,
                fullname: inquiry.firstname + inquiry.lastname,
                message: inquiry.message,
                bodyContent: '',

        }, {
                apiKey: '',
                domain: '',
                from: {
                    name: "Test",
                    email: inquiry.email
                },
                to: admin.email,
                subject: subject,

            }, done);
    }, callback);
}

来源:https://stackoverflow.com/questions/57197494/how-to-make-an-adf-xml-format-be-assigned-to-a-variable-without-getting-unxpecte

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!