| 1 | = Emaling from within your MOLGENIS application = |
| 2 | Since 3.4.x |
| 3 | |
| 4 | == Set your email settings in 'molgenis.properties'. |
| 5 | See MolgenisProperties. |
| 6 | |
| 7 | {{{ |
| 8 | ############################################################### |
| 9 | # 3. EMAIL settings if you want to email from within MOLGENIS plugins |
| 10 | # If you use smpts you may need to certify that you trust the server |
| 11 | # see http://blogs.sun.com/andreas/entry/no_more_unable_to_find |
| 12 | ############################################################### |
| 13 | |
| 14 | mail_smtp_from = noreply@molgenis.org |
| 15 | mail_smtp_protocol = smtps |
| 16 | # protocol is either smtp or smtps |
| 17 | mail_smtp_hostname = smtp.gmail.com |
| 18 | mail_smtp_port = 587 |
| 19 | mail_smtp_user = molgenis |
| 20 | mail_smtp_password = molgenispass |
| 21 | }}} |
| 22 | |
| 23 | == Add the following code to your plugin == |
| 24 | Inside your plugin you can use 'getEmailService()' to get access to the mail system. |
| 25 | For example: |
| 26 | {{{ |
| 27 | #!java |
| 28 | String from = "test@myserver.org"; |
| 29 | String to = "myfriend@anotherserver.org"; |
| 30 | String message = "Dear Mr. X. We welcome you to read our first email."; |
| 31 | this.getEmailService().email(from, message, to); |
| 32 | }}} |