Re: setting properties ??
Hi Ted, I am doing this if I want different settings from the application properties: ERJavaMail jm = ERJavaMail.sharedInstance(); Properties props = jm.defaultSession().getProperties(); props.put(mail.smtp.host, smtpHost); props.put(mail.smtp.auth, smtpAuth); props.put(mail.smtp.user, smtpUser); props.put(mail.smtp.password, smtpPassword); Session session = jm.newSession(props); ERMailDeliveryPlainText mail = new ERMailDeliveryPlainText(session); ... jw Am 29.10.2011 um 00:35 schrieb Theodore Petrosky: but how do you handle the situation where you don't know the smtp server, or the smtp server is changing? I want to store the smtp server (and port) as an attribute in my database then I can adjust it as needed. Am I thinking about this 'wrong'? TEd -- Message: 1 Date: Tue, 25 Oct 2011 00:34:43 +0200 From: Philippe Rabier prab...@me.com Subject: Re: setting properties ?? To: WebObjects Development webobjects-dev@lists.apple.com Message-ID: 476a4ac8-52de-4901-aa2f-df45dd3d4...@me.com Content-Type: text/plain; CHARSET=US-ASCII Theodore, I'm afraid you use properties the wrong way. Personally, I never set properties in my own code, only read them (except for frameworks I wrote of course). Properties are used to initialize informations. By setting default values in your framework, you can change them in your application. And you can have several properties files in your have with a different suffix (Properties.staging, Properties.production for example). Then you can set a user through the WOMonitor in the additional arguments like -Duser.name=staging and the right file will be opened. I hope you read the wiki because there are useful informations like http://wiki.objectstyle.org/confluence/display/WO/Project+Wonder+Properties+Files Now if you want to modify on the fly ERJavaMail, use the accessors like setCentralize(boolean) for example because properties can be read once during initialization. If you don't find an accessor, maybe you can't change it. I wouldn't be surprised if the smtp host is one of them. Philippe On 24 oct. 2011, at 16:39, Theodore Petrosky wrote: --- On Sun, 10/23/11, Kieran Kelleher kelleh...@gmail.com wrote: From: Kieran Kelleher kelleh...@gmail.com Subject: Re: setting properties ?? To: Theodore Petrosky tedp...@yahoo.com Cc: webobjects-dev@lists.apple.com 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(, er.javamail.smtpPassword); ERXProperties.setStringForKey(true, er.javamail.smtpAuth); ERXProperties.setStringForKey(tpetro...@agencysacks.com, 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(tedp...@yahoo.com, Theodore Petrosky); mail.setFromAddress(tpetro...@agencysacks.com, Ted
Re: Component based email without a context
Thanks Paul. Unfortunately, currentContext() will return null, since this will not be running inside a request/response loop. I'm probably just going to create a context to use… Ken On Oct 28, 2011, at 6:51 PM, Paul Hoadley wrote: Hi Ken, On 26/10/2011, at 11:40 PM, Ken Anderson wrote: I would like to be able send emails generated by components in the background without a user (or a context). Does anyone have a chunk of code for creating a WOContext to be populated for generating email from a WOComponent? This is how I do it (Wonder-based app): SomeEmailComponent component = ERXApplication.erxApplication().pageWithName(SomeEmailComponent.class, (WOContext) ERXWOContext.currentContext().clone()); Then later: ERMailDeliveryHTML mail = new ERMailDeliveryHTML(); mail.setComponent(component); -- Paul. http://logicsquad.net/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Validating Email
My spam filter swallows and drops (with no bounce) any mail to an unknown address. you could send an email that has a link to an image on your server. then when the request for the image comes in you know the receiver looked at the email. I know some spam filter settings block this kind of email, but it might work 50% of the time Ted Message: 1 Date: Tue, 25 Oct 2011 16:37:42 +0100 From: Gino Pacitti ginok...@mac.com Subject: Validating Email To: WebObjects-Dev Mailing List List webobjects-dev@lists.apple.com Message-ID: b324423b-3491-44ac-bb11-b749a0447...@mac.com Content-Type: text/plain; CHARSET=US-ASCII; format=flowed; delsp=yes Hi List Is there any Framework to validate if an email address being entered ACTUALLY exists... Not just that its correctly formatted but that the account exists on a server somewhere? I have an app that needs Contact Information validation GIno ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: ERAttachments, S3, and dynamic configurations
Hi Jesse, seems like that's worth a patch of code to wonder, no? Perhaps, but not in its current form, as it's quite specific. I think a lot of people have diverging implementations that could use consolidation and I'd like to move to something more common between everyone myself, so I'd like to see that happen if it can be done in such a way that makes sense. Sure thing. My requirements are specific - region and bucket info coming from the db, determined by ownership/client/what-have-you. Link-lifes determined at runtime. This is probably not everyone's aim, so yes, we'd need to determine common intentions. Mine are, well, in this thread. I think other people may want to persist object acls at some point. There are other considerations. Is this list the correct space to be discussing this, or is there another setting more appropriate? Cheers, Matt On Oct 24, 2011, at 6:59 PM, Matthew Ness wrote: Hi all, I'm using ERAttachments in a couple of my applications. Some are using the configuration type {S3}. For one of the applications using S3 I have a need to dynamically generate and use a sub-set of the ERAttachment configuration set. I cannot use the standard Properties approach, as the ERAttachments are not grouped/configured by the standard EO-ERAttachment relationship but other factors. That is, for any specific EO-ERAttachment relationship, there may be multiple configurations (defined by, say, ownership), and new configurations may be added over the course of the running app. The major (but not only) difference being the S3 bucket the ERAttachment will use. I realise I can send a configuration name to ERS3AttachmentProcessor, but that reads the bucket name from ERXProperties, rather than another type of persistence (in my case, db). I have in mind subclassing ERS3AttachmentProcessor, reading my configuration data based on my criteria, and processing the ERAttachment in that subclass based on that criteria. This seems to me a reasonable way to go, but maybe I'm missing something. Does this seem like a sound approach? Would you recommend an alternate approach, or am I missing something? Has anyone done something similar? Would it make more sense to not subclass, and assign my new class in ERAttachmentProcessor.addAttachmentProcessorForType? Likewise, I'd like to dynamically assign the linkLife of a generated URI of an S3 ERAttachment. On the face of it, it looks like I may need to build a new [My]S3Attachment/[My]AttachmentProcessor stack. Or is there another way to dynamically assign the linkLife each time an S3 URI is generated in ERAttachment? Lastly, this approach could allow the persistence of the acl value at creation time, but this may be a discussion for another time :) Thanks for any help, Matt Hi again, For what it's worth, I created a new attachment processor class and subsidiary classes which deal with AWS regions, buckets, and linkLifes to satisfy my requirements listed above. In my Application's finishInitialization I assigned this new processor to the ERS3Attachment.STORAGE_TYPE value. If anyone ever does something similar I'd be happy to help them out. Cheers, Matt ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/jtayler%40oeinc.com This email sent to jtay...@oeinc.com ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Component based email without a context
On 29/10/2011, at 10:42 PM, Ken Anderson wrote: Thanks Paul. Unfortunately, currentContext() will return null, since this will not be running inside a request/response loop. I'm probably just going to create a context to use… Oh, sorry Ken. I obviously didn't read your original post closely enough. Can you just call WOContext's constructor, then? (And won't you need a WORequest to do that? Sorry, now I've got more questions than answers for you.) -- Paul. http://logicsquad.net/ ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Component based email without a context
I use this in tests: testContext = new WOContext(new WORequest(GET, http://localhost/cgi-bin/WebObjects;, HTTP/1.1, null, null, null)); Not sure offhand what additional information might be needed to generate your email content. Chuck On 2011-10-29, at 10:09 PM, Paul Hoadley wrote: On 29/10/2011, at 10:42 PM, Ken Anderson wrote: Thanks Paul. Unfortunately, currentContext() will return null, since this will not be running inside a request/response loop. I'm probably just going to create a context to use… Oh, sorry Ken. I obviously didn't read your original post closely enough. Can you just call WOContext's constructor, then? (And won't you need a WORequest to do that? Sorry, now I've got more questions than answers for you.) -- Paul. http://logicsquad.net/ -- Chuck Hill Senior Consultant / VP Development Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems. http://www.global-village.net/products/practical_webobjects ___ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com