Email settings - Text based

Ayoub Ag. asked on August 3, 2017 22:48

Hello,

We’re currently using Kentico v9.0.50 and we’re experiencing an issue with the email settings. We’re trying to send the email in text-based format (via the email settings option set to either Both or Text-Based), however it seems like Kentico keeps sending the email in HTML regardless of our choice. It does that even when emptying the cache.

How can we go about to force Kentico to send the emails in text-based format (or at least include it as an attachment when sending a HTML-based email as well)?

Thank you,

Recent Answers


Zachary Perry answered on August 3, 2017 22:54

Does your email template have both the HTML and plain text filled out?

From the Documentation: You can choose between HTML and Plain text. If Both is selected and an email template has both formats defined, HTML will be used for the email text and plain text will be included as an attachment.

1 votesVote for this answer Mark as a Correct answer

Ayoub Ag. answered on August 4, 2017 15:07 (last edited on August 4, 2017 18:29)

Hi zachary, Thank you for your answer, my template contains both are filled out. but i don't receive the plain text email as an attachment. here is my config : Image Text

link to Config image

this is my email template : Image Text

link to Email Template image

thank you

0 votesVote for this answer Mark as a Correct answer

Zachary Perry answered on August 4, 2017 19:04

Are you sending the email from Custom code or is it something out of the box that is triggering it?

0 votesVote for this answer Mark as a Correct answer

Ayoub Ag. answered on August 4, 2017 19:32 (last edited on August 4, 2017 19:38)

I'm generating the content of the email by a custom code, then my service calls email controller on kentico side to add it to the email queue and then kentico is sending it using the native scheduled task CMS.Scheduler.QueueSender

As you can see on this print screen the email body is generated in plain Text, but whene i receive it the content is displayed only in HTML format

Image Text thank you

0 votesVote for this answer Mark as a Correct answer

Zachary Perry answered on August 4, 2017 19:39

In your code to create the email message, are you setting the email format (not sure if this will do it or not)?

                EmailMessage message = new EmailMessage();
                message.EmailFormat = EmailFormatEnum.Both;
1 votesVote for this answer Mark as a Correct answer

Ayoub Ag. answered on August 4, 2017 20:31 (last edited on August 4, 2017 21:58)

Yes, That's what i do in the code. here is my code

var message = new EmailMessage
        {
            EmailFormat = EmailFormatEnum.Both,
            From = template.TemplateFrom,
            CcRecipients = template.TemplateCc,
            BccRecipients = template.TemplateBcc,
            Recipients = emailModel.EmailAddress,
            Subject = macroResolver.ResolveMacros(template.TemplateSubject),
            PlainTextBody = macroResolver.ResolveMacros(template.TemplatePlainText),
            Body = macroResolver.ResolveMacros(template.TemplateText)
        };

       return message;
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.