--- On Sun, 10/23/11, Kieran Kelleher <[email protected]> wrote:
> From: Kieran Kelleher <[email protected]> > Subject: Re: setting properties ?? > To: "Theodore Petrosky" <[email protected]> > Cc: [email protected] > Date: Sunday, October 23, 2011, 10:42 PM > You can specify the properties in > your Properties file (inside Resources folder in your > project), for example: > > er.javamail.centralize=false > what I am discovering is that there are some ERJavaMail attributes that can be adjusted on the fly. centralize is not one of them. I have a little dummy app for testing and after I put the er.javamail.centralize=false in the Properties file, I can put: ERXProperties.setStringForKey("mail.agencysacks.com", "mail.smtp.host"); in my component and it will use this mail server. however if it is commented out, it will not find a mail server and the sending will fail. Now I will experiment to discover what other attributes MUST be in the Properties file and which can be adjusted on the fly. Ted > > On Oct 23, 2011, at 7:34 AM, Theodore Petrosky wrote: > > > I am working with sending email notifications when my > users save edits to EOs. > > > > I discovered that I can update the properties from my > app (in the application constructor) with: > > > > ERXProperties.setStringForKey("mail.agencysacks.com", > "mail.smtp.host"); > > ERXProperties.setStringForKey("35", > "mail.smtp.port"); > > ERXProperties.setStringForKey("false", > "er.javamail.centralize"); > > ERXProperties.setStringForKey("tpetrosky", > "er.javamail.smtpUser"); > > ERXProperties.setStringForKey("xxxx", > "er.javamail.smtpPassword"); > > ERXProperties.setStringForKey("true", > "er.javamail.smtpAuth"); > > ERXProperties.setStringForKey("[email protected]", > "er.javamail.adminEmail"); > > > > so (as I am just playing because I need to learn more) > I added some log statements in my save method: > > > > public WOActionResults saveChangesToItem() { > > . . . . . > > > > ERMailDeliveryHTML mail = new ERMailDeliveryHTML (); > > > > > IOChangeEmail component = > pageWithName(IOChangeEmail.class); > > mail.setComponent(component); > > > > > System.out.println("inside try mail.smtp.host = " + > ERXProperties.stringForKey("mail.smtp.host")); > > System.out.println("inside try mail.smtp.port = " + > ERXProperties.stringForKey("mail.smtp.port")); > > System.out.println("inside try er.javamail.centralize > = " + > ERXProperties.stringForKey("er.javamail.centralize")); > > System.out.println("inside try er.javamail.adminEmail > = " + > ERXProperties.stringForKey("er.javamail.adminEmail")); > > > > > mail.newMail(); > > > mail.setToAddress("[email protected]", > "Theodore Petrosky"); > > mail.setFromAddress("[email protected]", > "Ted Petrosky"); > > mail.setReplyToAddress("[email protected]", > "Ted Petrosky"); > > mail.setSubject("An IO was edited and saved!!"); > > > > > mail.sendMail(); > > > > . . . . > > } > > > > this is the console: > > > > Oct 23 02:27:06 ASChelseaLoginGrid[56901] DEBUG > NSLog - === Commit Internal Transaction > > inside try mail.smtp.host = mail.agencysacks.com > > inside try mail.smtp.port = 35 > > inside try er.javamail.centralize = false > > inside try er.javamail.adminEmail = [email protected] > > Oct 23 02:27:09 ASChelseaLoginGrid[56901] DEBUG > NSLog - === Begin Internal Transaction > > > > er.javamail.centralize was set to false in the > application constructor. However it was ignored and when I > looked at the logs in the mail server I see that the > toAddress was "[email protected]". > > > > which was odd as I was setting the adminEmail in the > application constructor also. > > > > After experimenting I find that these two properties > do not 'stick' even though my log statements claim that the > values are correct. > > > > ERXProperties.setStringForKey("false", > "er.javamail.centralize"); > > ERXProperties.setStringForKey("[email protected]", > "er.javamail.adminEmail"); > > > > bottom line, I got things to work, just not as I > expected. Is this correct? Should I be adjusting the > properties in the application constructor? If not, then > where. Or maybe the better question is, "Is there a better > way to do this?" > > > > > > Ted > > > > > > > > > > > > _______________________________________________ > > 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/kelleherk%40gmail.com > > > > This email sent to [email protected] > > _______________________________________________ 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]
