4

I have a basic SpringBoot 2.0.5.RELEASE app. Using Spring Initializer, JPA, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file.

I've configured the springboot properties as follows:

spring.mail.host=smtp.gmail.com
spring.mail.username=nunet@gmail.com
spring.mail.password=nunet999!
spring.mail.properties.mail.smtp.auth = true
spring.mail.properties.mail.smtp.socketFactory.port = 465
spring.mail.properties.mail.smtp.socketFactory.class = javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.socketFactory.fallback = false
spring.mail.propertirs.mail.smtp.ssl.enable = true

and It is working fine when sending emails. I also have an email address from my domain info@nunet.com

I am using Postfix to forward the Emails from info@nunet.com to to nunet@gmail.com and its working fine.

I would like to know if there is a way to do it on the other way around. Send emails from info@nunet.com but using nunet@gmail.com smtp to avoid to install a Mail server.

or basically I would like to know how to extract the smtp properties from my linux server, because from there I can send emails using the command

cat ~/test_message | mail -s 'Test email subject line' nunet@gmail.com
Nuñito Calzada
  • 4,394
  • 47
  • 174
  • 301

2 Answers2

1

Basically this is possible with SMTP, but the most SMTP-Hoster don't allow it to avoid spammers to send spam. Furthermore the most E-Mail-Hoster will detected that kind of mails as spam.

benkuly
  • 1,144
  • 10
  • 28
1

I think you need Google Suite's email feature. With this feature You can create a custom email address using your own domain name then send & receive emails with Gmail (Gmail Suite).

After configuration working with Gmail's SMTP is same as you done before.

Read more: https://digital.com/blog/create-email-using-gmail/#ixzz5Sxusynvb

M-Razavi
  • 3,327
  • 2
  • 34
  • 46
  • Yes, because it doesn't need any extra work on your code, Google handle this process. It's like you send email from your Gmail account, but email address is from your domain. – M-Razavi Oct 05 '18 at 07:29
  • @EnNuNYetdeCanCalÇadA what is your host control panel? This is google help for setting up MX records in various Control-panels. https://support.google.com/a/topic/1611273 – M-Razavi Oct 06 '18 at 10:18