the error is in the attachments code.
It looks like you are using Universal Email 3. in UE3, you need to use Digital File Pro to upload the file in order to attach it, see the "Sending Email Attachments with Digital File Pro and Universal Email " tutorial in the archived documentation section of the Universal Email support page:
universal-email/