public void sendEmail() {
GSEISPersonAccountInfoComponent acctPdf = (GSEISPersonAccountInfoComponent)pageWithName(GSEISPersonAccountInfoComponent.class.getName());
acctPdf.setAPerson(aPerson()); //create PDFWrapper component
NSLog.out.appendln("making pdf");
NSData pdf = acctPdf.generateResponse().content(); //get the PDF data
ERMailDeliveryHTML mail = new ERMailDeliveryHTML();
try {
mail.newMail();
mail.setSubject("GSE&IS Account Info");
mail.setComponent(this); //send this component as a new component based email
mail.setToAddresses(new NSArray (aPerson().emailAddress()));
//attach PDF to email
NSLog.out.appendln("this is where I want to attach pdf"); //never get here
mail.addAttachment(new ERMailDataAttachment(acctPdf.pdfFilename(),null,pdf));
mail.sendMail();
} catch (Exception e) {
e.printStackTrace();
}
}
This code is in my "emailed" component so it sets itself as the body of a new email - then tries to attach a PDF generated with ERPDFWrapper. This is called from a DirectAction. I'm not returning either the PDF or the email component to the browser. Am I violating best practices by trying to use the PDF wrapper without returning it?
Tim
UCLA GSE&IS