<!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG-spv-->{"id":1923448,"date":"2021-06-13T03:13:00","date_gmt":"2021-06-13T01:13:00","guid":{"rendered":"http:\/\/nhub.news\/?p=1923448"},"modified":"2021-06-13T05:02:07","modified_gmt":"2021-06-13T03:02:07","slug":"how-to-activate-new-user-accounts-by-email","status":"publish","type":"post","link":"http:\/\/nhub.news\/ru\/2021\/06\/how-to-activate-new-user-accounts-by-email\/","title":{"rendered":"How to Activate New User Accounts by Email"},"content":{"rendered":"<p style=\"text-align: justify;\"><b>In a previous article, I explained how to create an activation link for new users of a web app. In this article, I&#8217;ll show you how to send that link via &#8230;<\/b><br \/>\nJoin the DZone community and get the full member experience. In a previous article, I explained how to create an activation link for new users of a Vaadin web application. In this article, I&#8217;ll show you how to send that link via email using SMTP. Spring Boot makes it easy to start sending emails from the app. We just need to add the following to the section of the pom.xml file: Now we can change the AuthService class to send a message through email instead of printing it in the console. For that, we need a MailSender instance that Spring Boot autoconfigures for us: We can use this object in the register method to effectively send an email message: In production, you will have to set up an SMTP server or use an existing one (like Gmail or Outlook) to send email messages. In your development environment, you can use something like FakeSMTP, a free SMTP server that incidentally is written in Java. Download it at http:\/\/nilhcem.com\/FakeSMTP, run it, set the port to 9090, and start the server. In the application.properties file add the following connection properties: You can of course change the values to connect to your SMTP provider when you deploy the application to production (in which case you&#8217;ll most likely need to add the spring.mail.password property as well). If you run the app at this point, you&#8217;ll get an error. This is due to a dependency conflict. To solve it, add the following exclusion to the vaadin dependency: That&#8217;s it! To test the functionality, run the app using mvn, create a new user using the app and see the email in the FakeSMTP window. Opinions expressed by DZone contributors are their own.<\/p>\n<script>jQuery(function(){jQuery(\".vc_icon_element-icon\").css(\"top\", \"0px\");});<\/script><script>jQuery(function(){jQuery(\"#td_post_ranks\").css(\"height\", \"10px\");});<\/script><script>jQuery(function(){jQuery(\".td-post-content\").find(\"p\").find(\"img\").hide();});<\/script>","protected":false},"excerpt":{"rendered":"<p>In a previous article, I explained how to create an activation link for new users of a web app. In this article, I&#8217;ll show you how to send that link via &#8230; Join the DZone community and get the full member experience. In a previous article, I explained how to create an activation link for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1923447,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts\/1923448"}],"collection":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/comments?post=1923448"}],"version-history":[{"count":1,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts\/1923448\/revisions"}],"predecessor-version":[{"id":1923449,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/posts\/1923448\/revisions\/1923449"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/media\/1923447"}],"wp:attachment":[{"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/media?parent=1923448"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/categories?post=1923448"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nhub.news\/ru\/wp-json\/wp\/v2\/tags?post=1923448"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}