On Jun 26, 2006, at 7:26 AM, Drew Thoeni wrote:
I am trying to set the SMTP host for JavaMail. I have attempted set
the properties in the Application, in the component, and in
Resources->Properties. None of these approaches seems to get the
props set (per exception at the end of this email).
In the Application() using this code:
public Application() {
super();
Properties props = System.getProperties();
//Specify the desired SMTP server
props.put( "WOSMTPHost", "smtp.comcast.net" );
props.put( "mail.smtp.host", "smtp.comcast.net" );
}
Drew,You code only changes the values inside the "props" object that you got back as a result of the System.getProperties() call. You need to set them back into the system by using the System.setProperties ( Properties ) call, or two calls to System.setProperty( String, String ).
Alternatively, you can specify the properties outside of the code in two places. First, in the Properties file that is located inside the .woa bundle at MyApp.woa/Contents/Resources/Properties, you can put the lines:
WOSMTPHost=smtp.comcast.net
mail.smtp.host=smtp.comcast.net
just as written and they will set the WOSMTPHost and mail.smtp.host
properties for the application. Alternatively, you can launch the
application with the arguments:
-DWOSMTPHost=smtp.comcast.net -Dmail.smtp.host=smtp.comcast.net
in addition to any other launch arguments and the properties will be
set. Note that there is no space between the "-D" and the property
name, and that any characters that will cause problems for the shell
will need to be escaped or quoted.
In general, setting properties through code is discouraged -- much better to do it from the Properties file for properties that don't change frequently and from launch arguments for those that do change frequently. BTW, property values specified on the command line override those specified in the Properties file. See the WO API docs on NSProperties for more details.
HTH --PaulPaul Suh http://www.ps-enable.com/
[EMAIL PROTECTED] (240) 672-4212
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
