Closed snicoll closed 9 years ago
Thanks @snicoll Yes this is one of the first things I coded in JHipster, and this was before the mail support in Spring Boot. So this needs a clean up!
If you have time to have a look at it I'd appreciate it, of course. Be careful, we also have a specific healthcheck for the mail (again, this was coded a long time ago), and it's internationalized.
@snicoll could your code also work with http://docs.run.pivotal.io/marketplace/services/sendgrid.html ?
I'd love to deploy to cloud foundry and automatically have the mail service working -> that would be really great for my demos!! That's more than the database service everybody expects.
Tell me if you have time to work on this, otherwise I'll have time next week, probably.
@snicoll do you have time to work on this? Otherwise I will take a look
@snicoll when can you work on this? If you are in Spring IO in Barcelona in 2 weeks, we could spend together fixing this.
Sorry Julien, I don't have time to work on that.
The main point really was to point out that you shouldn't use the spring
namespace for configuration keys and we have a mail health indicator in 1.3 so you may want to reuse that.
Spring 1.2 brings a really cool integration with both IJ and STS so your users may benefit from that as well. In any case, I'll be in Barcelona so please reach out there. Thanks.
@snicoll I've had a look at this and there's something I don't understand -> when trying to use the MailSenderAutoConfiguration I keep having a
NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.mail.javamail.JavaMailSenderImpl]
I looks like I can't inject that bean inside my service beans, as it's not created yet. I have no idea why!
So I'm going to keep my implementation but move it to another namespace.
I'll close this with my commit:
I guess you missed the part where I am saying the mail support is in 1.3 (we have a mail health indicator in 1.3).
What is the point of closing this issue if what is discussed isn't implemented?
Oh yes I missed that point, that explains a lot!!
I was closing it as I couldn't fix it, now I'm reopening it
Here's what I used on Heroku to configure the Sendgrid addon.
mail:
host: smtp.sendgrid.net
port: 587
username: ${SENDGRID_USERNAME}
password: ${SENDGRID_PASSWORD}
protocol: smtp
tls: false
auth: true
from: app@21-points.com
@mraible this should be added to the http://jhipster.github.io/tips.html section
I was using Application.yml config much like mraible's example above, however not a cloud deployment. No longer works for me. With MailConfiguration.java removed, what is the basic approach now? Should MailService.java be modified to add properties to JavaMailSenderImpl like SMTP and TLS settings?
Any guidance? I must admit I haven't dug into how to manage this problem from a Spring Boot point of view. I thought I would pose the question here first.
Thank you, Rob
it's spring boot configuration You have to modify your application-dev.yml or application-prod.yml Here an example with GMail :
mail:
host: smtp.gmail.com
port: 587
username: xxxx@gmail.com
password: xxxx
properties.mail.smtp:
auth: true
starttls.enable: true
Thank you very much :-)
mail:
host: smtp.gmail.com
port: 587
username: emailid@gmail.com
password: xxxxx
protocol: smtp
tls: true
properties.mail.smtp:
auth: true
starttls.enable: true
ssl.trust: smtp.gmail.com
Need to add ssl.trust: smtp.gmail.com
in above config by @pascalgrimaud to avoid below exception:
Failed messages: javax.mail.MessagingException: Could not convert socket to TLS
Spring Boot 1.2 has added an annotation processor that generates the meta-data of any
@ConfigurationProperties
annotated pojo of the current build. IDE can then use those meta-data to offer assistance (key auto-completion, etc)I wanted to contribute a PR to enable this for any key that JHipster might use and I stumbled upon
_MailConfiguration
. Regardless of the fact that Spring Boot now supports such service in the core, I see several issues:spring.*
namespace. If you want your own service, usejhipster.*
or somethingI haven't looked deeper than that but I am happy to look at this issue with you and see how we can generate proper meta-data for the configuration keys defined by jhipster.