Description
This bundle provides a ConnectionFactory to send mails thru the IO Connector Service
This bundle embeds and uses two jar files: mail.jar (the Javax Mail Framework) and activation.jar (the Java Activation Framework)
For more details on how to use this bundle, refer to the /doc/readme.html file embedded in the bundle jarfile.
Contributors
Didier Donsez (Didier.Donsez@ieee.org)
License
LGPL
Services
org.osgi.service.io.ConnectionFactory
Properties
io.scheme={ "mail", "mailto" }
Requirements
org.osgi.service.io; specification-version=1.0
javax.microedition.io
Download
Build
Settings
Configure the bundle properties (SMTP hostname, ...) in the /res/config.properties
Usage
see chapter 13 in OSGi release 3
configure the properties (mail server, sender mail address) in the file (/config.properties in the bundle, /res/config.properties in the source dir)
use this code to test
... ServiceReference[] tempRefs = null; tempRefs = bundleContext.getServiceReferences( ConnectorService.class.getName(), null); if (tempRefs == null) { return; } ServiceReference sr = tempRefs[0]; ConnectorService connectorService = (ConnectorService) bundleContext.getService(sr); Connection connection = connectorService.open( "mail:somebody@somewhere.org?SUBJECT=test&X-Mailer=experimental", ConnectorService.WRITE, false); if (connection instanceof OutputConnection) { DataOutputStream os = ((OutputConnection) connection).openDataOutputStream(); os.writeUTF("This is just a test"); } connection.close(); ...
Tested gateways
TODO (contributions are welcome)