{"id":101,"date":"2014-12-23T12:36:43","date_gmt":"2014-12-23T12:36:43","guid":{"rendered":"http:\/\/smartfoxserver.com\/blog\/?p=101"},"modified":"2015-01-08T11:23:21","modified_gmt":"2015-01-08T11:23:21","slug":"how-to-send-an-email-from-an-extension","status":"publish","type":"post","link":"https:\/\/smartfoxserver.com\/blog\/how-to-send-an-email-from-an-extension\/","title":{"rendered":"How to send an email from an Extension"},"content":{"rendered":"<p>Emails can be sent directly from your server side code in order to provide registration confirmations, updates or even debugging and stats reports.<\/p>\n<p>In order to enable email sending you will need to setup the Emailer Service from the AdminTool: from the<strong>ServerConfigurator<\/strong> choose the <strong>Emailer<\/strong> tab, turn on the service and set your SMTP parameters.<!--more--><\/p>\n<p>Restart the server and you are now ready to send emails using a couple of lines of code like this:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nEmail myEmail = new SFSEmail(&quot;sender@email.com&quot;, &quot;recipient@email.it&quot;, &quot;Test mail&quot;, &quot;Hello from SFS2X&quot;);\r\nSmartFoxServer.getInstance().getMailService().sendEmail(myEmail);\r\n<\/pre>\n<p>There are three modalities to send emails: &#8220;blindly&#8221;, with a confirmation event and delayed. You can learn about this and lots more from the <a href=\"http:\/\/docs2x.smartfoxserver.com\/api-docs\/javadoc\/com\/smartfoxserver\/v2\/entities\/managers\/SFSPostOffice.html\" target=\"_blank\">SFSPostOffice class<\/a> in the javadoc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Emails can be sent directly from your server side code in order to provide registration confirmations, updates or even debugging and stats reports. In order to enable email sending you will need to setup the Emailer Service from the AdminTool: from theServerConfigurator choose the Emailer tab, turn on the service and set your SMTP parameters.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[7],"_links":{"self":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts\/101"}],"collection":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/comments?post=101"}],"version-history":[{"count":2,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts\/101\/revisions"}],"predecessor-version":[{"id":139,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/posts\/101\/revisions\/139"}],"wp:attachment":[{"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/media?parent=101"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/categories?post=101"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartfoxserver.com\/blog\/wp-json\/wp\/v2\/tags?post=101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}