func init // adds using namespace sys.add_use('D.Net.EmailInterfaces') sys.add_use('D.Net.EmailClient') // initialize instance if(linked("Body") and linked("doAttachment")) sys.add_var(this.name, 'byte[]') end if(linked("Name") and linked("doAttachment")) sys.add_var('attach', 2) end end func doAttachment(data) if(linked("Name")) blk.println(this.attach, ' = ', this.make_name(data), ';') end if(linked("Body")) blk.println(this.codename, ' = ', this.make_body(data), ';') event("onAttachment", this.codename) else event("onAttachment", this.make_body(data)) end end func Body if(linked("doAttachment")) return(this.codename) else return(this.make_body()) end end func Name if(linked("doAttachment")) return(this.attach) else return(this.make_name()) end end func Count return(d("Attachment") + '.Count') end func make_body(data) return(d("Attachment") + '.Body') end func make_name(data) return(d("Attachments") + '.Text') end