I have a template field in my object in which i store the whole email template and store it like below "<p><span style=\"font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;\">%recipient.email%<b><br></b></span><b> <br> </b><span style=\"font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;\">%recipient.tier_name%</span></p>"
in this %recipient.email% is my variable and it will changed by mailgun automatically but the issue is sometimes it does not reflect and appear as it is in the email with out changing its actaul value
example: If recipient.email = test@gmail.com but in email it is showing %recipient.email% instead of test@gmail.com
I want to apply the variable values instead of its variable names. example: If recipient.email = test@gmail.com but in email it is showing %recipient.email% instead of test@gmail.com
def self.send_emails(subject:, html:, to_emails:, recipient_variables: {}, force_send: false, sender_email)
payload = {
from: sender_name(sender_email),
subject:,
html:,
'recipient-variables': recipient_variables.to_json,
'o:tag': [subject, tag]
}
esponse = RestClient.post(mailgun_api_url(sender_email), payload)
end
Aucun commentaire:
Enregistrer un commentaire