Allow custom filename for attachment

Hi,

here is small modification made by @leppi. It allows to pass filename as optional parameter for attachment.