Fabian Peters wrote:
Hi Drew,

see <http://en.wikibooks.org/wiki/Programming:WebObjects/ Project_WONDER/Frameworks/ERJavaMail#Gotchas>

cheers

Fabian



I return "this" from the action method rather than null which seems to work ok, YMMV. Note: The behaviour is not WONDER specific, it happens with the standard WOMailDelivery aswell.


Am 01.08.2006 um 12:50 schrieb Drew Thoeni:

I'm successfully using ERJavaMail to send HTML components. However, each time this method gets run, the user is returned the HTML component page that is emailed. Instead, I would like the user to remain on the page from which the email was sent (there's a submit button on that page that send the email).

Does anyone know why the EMailPage would be returned and, more important, how to stop that behavior?

Regards,

Drew


    public void sendEmail() {
    // Create an instance of an ERMailDelivery subclass
    ERMailDeliveryHTML mail = new ERMailDeliveryHTML();
// set all needed fields String fromAddress = reportEntryItem.employeeassignedto ().secondaryEmail();
    <snip> removed code for setting other fields </snip>

// ERMailDeliveryHTML needs a WOComponent to render the HTML text content.
    session.setReportEntryItemToEmail( reportEntryItem );
    EMailPage pageToEmail = ( EMailPage )pageWithName( "EMailPage" );
    mail.setComponent( pageToEmail );
// 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    ( fromAddress, fromName );  // Strings
        mail.setSubject         ( subject );
        mail.setToAddress      ( toAddress , toName ); // Strings
        mail.setBCCAddresses   ( bccAddresses ); // NSArray

        mail.sendMail();
    }
    catch (Exception e) {
System.out.println( "Email exception: " + e ); //replace with NSLog
    }
    }

cheers,
 - shaun

_______________________________________________
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]

Reply via email to