how to get email set up in global file

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2012 08:15 PM
Hi all,
Can you tell me how to get the Alfresco email set up in the alfresco-global.properties file from the web script?
My server has the out-bound email set up and I want to use javax.mail to send out HTML email. So I need to know the email host and address, which is already stored in the global.properties file.
And I want to get it out by web script instead of hard code on the source. Can you tell me how to do it?
Cheers,
Daniel
Can you tell me how to get the Alfresco email set up in the alfresco-global.properties file from the web script?
My server has the out-bound email set up and I want to use javax.mail to send out HTML email. So I need to know the email host and address, which is already stored in the global.properties file.
And I want to get it out by web script instead of hard code on the source. Can you tell me how to do it?
Cheers,
Daniel
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2012 05:27 PM
Daniel,
Probably the easiest way to do it is to simply inject the values into your web script through Spring configuration. This is exactly what Alfresco does for its own beans and you have access to the same substitution variables.
It would look something like this:
Jeff
Probably the easiest way to do it is to simply inject the values into your web script through Spring configuration. This is exactly what Alfresco does for its own beans and you have access to the same substitution variables.
It would look something like this:
<beans> <bean id="webscript.com.someco.GetGlobalProperty.get-global-property.get" class="com.someco.scripts.GetGlobalProperty" parent="webscript"> <property name="host"> <value>${mail.host}</value> </property> <property name="port"> <value>${mail.port}</value> </property> <property name="protocol"> <value>${mail.protocol}</value> </property> </bean></beans>
Then, in your Java-backed web script controller, assuming you had getters and setters that matched up to those properties (like getHost, setHost, getPort, setPort), you could just call those getters to grab the values.Jeff
