Attach a PDF to an email

This worked, thanks for the help guys.

In my models and interceptors I do it like so:

Body=renderer.renderlayout(“layout.email”);

Daniel M

I forgot to ask you guys this yesterday but I had something really strange come up.

The following will produce an attachment with the name of Untitled Attachment 005.pdf / Any dynamic variable here is causing an issue.

mail.addMailParam( file=“Leads-#order.getAgent()#-#dateFormat(leadDate,‘mm-dd-yyyy’)#.pdf”, type=“application/pdf”, content=leadsAttachment );

This will attach a file with the name of Leads.pdf. What is going on here?

mail.addMailParam( file=“Leads.pdf”, type=“application/pdf”, content=leadsAttachment );

Doesn’t matter what the variables are, any dynamic variable there causes an Untitled Attachment name, completely lost on this one.