• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: JavaMail Props Not Being Set
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JavaMail Props Not Being Set


  • Subject: Re: JavaMail Props Not Being Set
  • From: Mike Schrag <email@hidden>
  • Date: Mon, 26 Jun 2006 16:08:03 -0400

You might want to check your classpath, too ... That it's saying there's no SMTP provider sounds like you might have the javamail API jar file in your classpath, but not the reference implementation jar files that actually include the SMTP implementation code?

ms

On Jun 26, 2006, at 3:39 PM, Paul Suh wrote:

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


--Paul


Paul Suh http://www.ps-enable.com/
email@hidden (240) 672-4212


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: JavaMail Props Not Being Set
      • From: Drew Thoeni <email@hidden>
References: 
 >JavaMail Props Not Being Set (From: Drew Thoeni <email@hidden>)
 >Re: JavaMail Props Not Being Set (From: Paul Suh <email@hidden>)

  • Prev by Date: Re: JavaMail Props Not Being Set
  • Next by Date: Re: JDBCPrototypes and EOgenerator
  • Previous by thread: Re: JavaMail Props Not Being Set
  • Next by thread: Re: JavaMail Props Not Being Set
  • Index(es):
    • Date
    • Thread