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 } }
|