Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29762

Dynamic sendgrid templates being sent as plain text

$
0
0

I'm sending email through sendgrid, but when I receive the email, the email is in plain text format, and I would like to send it in html format. The variable data is the data I pass to sgMail.send.

module.exports = {
data: {
    to: '',
    from: '',
    subject: '',
    text: '',
    templateId: '',
    dynamic_template_data: {
        value_precip: undefined,
        value_humidity: undefined,
        value_windSpeed: undefined,
        value_condition: undefined,
        value_activiti: undefined
    }
},

set: function(to, from, subject, text, templateId, params) {
    this.data.to = to
    this.data.from = from
    this.data.subject = subject
    this.data.text = text
    this.data.templateId = templateId,
    this.data.dynamic_template_data.value_precipitation = params.value_precipitation
    this.data.dynamic_template_data.value_humidity = params.value_humidity
    this.data.dynamic_template_data.value_windSpeed = params.value_windy
    this.data.dynamic_template_data.value_condition = params.value_condition
    this.data.dynamic_template_data.value_activiti = params.value_activiti

},
    send: function() {
    try {
        sgMail.send(this.data)
    } catch (error) {
        console.log(error)
    }

   }
}

I don't know what may be causing this problem, if anyone can help me I would be grateful!


Viewing all articles
Browse latest Browse all 29762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>