Sysmailerattachments

If you use SMTP to send attachments, you cannot rename the attachment without saving it to disk and renaming it there. This new method on the SysMailerAttachments class applies a technique described on the web. The method should be called just after the attachment is added to the end of the email's attachment collection.

void renameAttachment(str _newName) {   InteropPermission permission = new InteropPermission(InteropKind::ComInterop);

SysMailerFields fields; int            item; COM            _BodyPart; ;   permission.assert;

item = _COM.count; // last attachment in collection _BodyPart = _COM.item(item); fields = SysMailerFields::create(_BodyPart.fields); fields.add("urn:schemas:mailheader:content-disposition", "attachment; filename="+_newName); }

The method was developed for AX2009 SP1 but likely can be backported to earlier versions.