Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To be able to send any emails from Weave you must provide Weave with the details of a mail server that will be used to send the emails. This is done using the com.cohga.server.mail configuration options

...


<?xml version="1.0" encoding="UTF-8"?>

<config	xmlns="urn:com.cohga.server.config#1.0" xmlns:mail="urn:com.cohga.server.mail#1.0">

	<mail:smtp>
		<host>mail.sforbes.net</host>
		<username>sforbes</username>
		<password>ENCEAUFJCUABCFXEMFQABFJEBZJAKFCXGME</password>
	</mail:smtp>

</config>

The smtp config requires at least the host property, to provide the hostname or ip address of the mail server. It may also requires the username and password setting if the mail server requires authentication before it will send any email (the password can be encrypted using the encrpyt command and the osgi prompt).
Additionally any setting supported by the Java Mail API may also be specified, by removing the mail.smtp. prefix from the setting and including it in the smtp config.
The available Java Mail API setting are available here.

Note

There should only ever be one SMTP server configured for Weave.
Multiple components that support emailing will all use the same SMTP server to send their emails.

Information on this can be found at Email Server.

Setting up email settings

...

Code Block
xml
xml
titleBasic emails settings

<?xml version="1.0" encoding="UTF-8"?>

<config	xmlns="urn:com.cohga.server.config#1.0" xmlns:report="urn:com.cohga.server.report#1.0">

	<report:email id="feedback">
		<from>noreply@sforbes.net</from>
		<to>feedback@sforbes.net</to>
	</report:email>

</config>

...

Code Block
xml
xml
titleFrom address from userid and hosts domain

		<from>${userid}@${domain}</from>

...

Code Block
xml
xml
titleFrom address from userid with a fixed domain

		<from>${userid}@sforbes.net</from>


unmigrated-wiki-markup
Note

It's

possible

to

use

the

${userid}

(and

${domain})

value

in

the

{{

to

}}

address,

which

would

allow

the

user

to

email

the

report

to

themselves,

but

this

hadn't

been

tested.

I

just

though

of

it

while

writing

the

above

documentation.

The default subject used to send the email is "Weave Report", which can be changed be either setting a subject property in the email config or by setting the report.email.subject i18n resource value.

...

Code Block
xml
xml
titleSetting subject and message

<?xml version="1.0" encoding="UTF-8"?>

<config	xmlns="urn:com.cohga.server.config#1.0" xmlns:report="urn:com.cohga.server.report#1.0">

	<report:email id="feedback">
		<from>noreply@sforbes.net</from>
		<to>feedback@sforbes.net</to>
		<subject>Feedback</subject>
		<message>The following has been submitted as a feedback report</message>
	</report:email>

</config>

...

Code Block
xml
xml
titleSetting subject and message using i18n resources

<?xml version="1.0" encoding="UTF-8"?>

<config	xmlns="urn:com.cohga.server.config#1.0" xmlns:report="urn:com.cohga.server.report#1.0" xmlns:client="urn:com.cohga.html.client#1.0">

	<client:resources>
		<resource id="report.email.subject">Feedback</resource>
		<resource id="report.email.message">The following has been submitted as a feedback report</resource>
	</client:resources>

	<client:resources lang="it">
		<resource id="report.email.subject">Retroazione</resource>
		<resource id="report.email.message">È stata presentata la seguente come un rapporto di feedback</resource>
	</client:resources>

	<report:email id="feedback">
		<from>noreply@sforbes.net</from>
		<to>feedback@sforbes.net</to>
	</report:email>

</config>

...

Code Block
xml
xml
titleSimple report action to email a report

	<item action="com.cohga.client.action.simplereport">
		<email>feedback</email>
		<format>html</format>
		<report>br_map</report>
		<label>Feedback</label>
		<tooltip>
			<title>Feedback</title>
			<text>Send a feedback report using the current map</text>
		</tooltip>
	</item>

...

Code Block
xml
xml
titleSpecifying email properties directly in the report action

	<item action="com.cohga.client.action.simplereport">
		<email>
			<from>${userid}@sforbes.net</from>
			<to>feedback@sforbes.net</from>
		</email>
		<format>html</format>
		<report>br_map</report>
		<label>Feedback</label>
		<tooltip>
			<title>Feedback</title>
			<text>Send a feedback report using the current map</text>
		</tooltip>
	</item>

...

Code Block
xml
xml
titleExtending email properties

	<item action="com.cohga.client.action.simplereport">
		<email id="feedback">
			<from>${userid}@sforbes.net</from>
			<to>feedback@sforbes.net</from>
		</email>
		<format>html</format>
		<report>br_map</report>
		<label>Feedback</label>
		<tooltip>
			<title>Feedback</title>
			<text>Send a feedback report using the current map</text>
		</tooltip>
	</item>

The above example does user use the feedback email config, and replaces the values from it with those included in the report item, using those from the email config where the aren't set directly.