AW: Need help with using ERJavaMail in Project Wonder
AW: Need help with using ERJavaMail in Project Wonder
- Subject: AW: Need help with using ERJavaMail in Project Wonder
- From: "Thomas Engeroff" <email@hidden>
- Date: Mon, 11 Oct 2004 22:37:09 +0200
Hi Nick,
I'm using ERJavamail in one of my projects, therefore I can try to help.
The configuration of ERJavamail is pretty straight forward. You need to copy
the properties from this sample file to your Properties file in your
WO-project folder. Then you need to edit this sample configuration to meet
your needs.
You can use Javamail in your code like this:
/**
* send email via javamail api
* @param person
* @throws Exception
*/
private void sendmail(ContactValueObject person) throws Exception {
String toEmailAdress = "email@hidden";
NSArray cc = new NSArray(person.getEmail()); // copy to costumer
String subject = "mailsubject";
// send mail
// initialise wo component (the component to send as a mail
ContactMailPage mailPage =
(ContactMailPage)pageWithName("ContactMailPage") ;
// set values of component
mailPage.setContactValueObject(person);
// Create an instance of an ERMailDelivery subclass
ERMailDeliveryHTML mail = new ERMailDeliveryHTML();
// Here ERMailDeliveryHTML needs a WOComponent to render the HTML
text content.
mail.setComponent(mailPage);
//Here you create a new instance of the message
//You can loop over this fragment of code, not forgetting to use
newMail ()
//before you set the attributes of the message.
try {
mail.newMail ();
mail.setFromAddress(person.getEmail());
mail.setCCAddresses(cc);
mail.setReplyToAddress(person.getEmail());
mail.setSubject(subject);
mail.setToAddress(toEmailAdress);
// Send the mail
mail.sendMail();
} catch (Exception e) {
// handle the exception ...
throw e;
}
}
Well, that's the whole magic you need ;-)
I'm sure you'll get it going.
Regards,
Thomas
> -----Ursprüngliche Nachricht-----
> Von: webobjects-dev-bounces+thengeroff=email@hidden
> [mailto:webobjects-dev-bounces+thengeroff=email@hidden] Im
> Auftrag von Nick Yang
> Gesendet: Montag, 11. Oktober 2004 20:51
> An: WebObjectsDev (Group)
> Betreff: Need help with using ERJavaMail in Project Wonder
>
> Dear WO gurus,
>
> I am having trouble installing and using ERJavaMail in Project Wonder.
> Can anybody offer any help?
>
> I have never used PO but it want to try because I am encountering bugs
> with WOMailDelivery.
>
> What I have done with PO:
>
> - downloaded PO
> - moved all the frameworks to /Library/Frameworks
> - added ERExtensions.framework and ERJavaMail.framework to my WO app
>
> My question is where do I configure ERJavaMail? In the readme, it says
> "Copy and customize the properties given in SampleConfiguration.txt
> under 'Support' group in the project files." I don't quite understand
> that. Do I create a Configuration.txt and add it to my project?
>
> Sorry for such newbie question.
>
> Regards,
>
> Nick
>
> _______________________________________________
> 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
_______________________________________________
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