Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type is set as text/plain, not html, when using Freemarker #55

Open
konst123 opened this issue Jun 28, 2017 · 11 comments
Open

Content-Type is set as text/plain, not html, when using Freemarker #55

konst123 opened this issue Jun 28, 2017 · 11 comments
Assignees
Labels

Comments

@konst123
Copy link

I create an Email via DefaultEmail.builder() and send it via emailService.send with a Freemarker template (without attachments).
The problem is that the Content-Type is set to text/plain, not html:

MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----=_Part_1_600820203.1498641103737"

------=_Part_1_600820203.1498641103737
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!doctype html>
<html>
	<body>

I can also see that the MimeMessage returned from emailService.send has only one part with objectMimeType set to text/plain; charset=UTF-8.

I tried to set customHeaders but it does not help.

@robertotru robertotru self-assigned this Jun 28, 2017
@robertotru
Copy link
Member

Hey, I have to check. I'll let you know asap

@konst123
Copy link
Author

It is strange, but if I deploy the same app on the server in use text/html:

Content-Type: multipart/mixed; 
	boundary="----=_Part_0_1245359920.1498747402081"
X-Yandex-Forward: 0fdc2ca0db90b35549dc87b16843c851

------=_Part_0_1245359920.1498747402081
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit

<!doctype html>
<html>
	<body>

But when I test the same code locally on my Windows PC, it send it as text/plain as in the example above.

@robertotru
Copy link
Member

Is the server running Linux or Windows?

@konst123
Copy link
Author

Linux. It is Google App engine flexible environment.

@robertotru
Copy link
Member

Can you provide a reproducible example. I'd like to see if it provides the same output on my Mac

@robertotru
Copy link
Member

Closing because of missing feedback

@konst123
Copy link
Author

konst123 commented Aug 3, 2017

I think this is the problem described here.
https://stackoverflow.com/questions/5028670/how-to-set-mimebodypart-contenttype-to-text-html

It sends html in the prod server, but do not send html in a unit test.

They recommend using MimeMessage.saveChanges()

@robertotru
Copy link
Member

@konst123 thanks for poiting to that SO answer.
I updated master. Could you try to see if master now solves your issue?

Best
Roberto

@konst123
Copy link
Author

konst123 commented Aug 4, 2017

Thank you. I tried it but it doesn't help - I have the same result. The problem maybe somewhere else.

@drmzperx
Copy link

Hi, I have the same problem. I use the mustache html template example (version 0.6.3). When I use the spring-boot app with locally (mvn appengine:run) the html message shows perfectly. But, when I deploy the app to google app engine, the message show text/plain content-type (in gmail web client). The html template starts with <!doctype html>.

Thanks, Attila

@robertotru
Copy link
Member

@drmzperx so it seems a problem of environment configuration. I'm sorry but I can only debug issues on my local environment. I think you will need to understand what's different in the settings in your local env and in the remote one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants