Re: [Mrpostman-developers] Creating attachments and referencing from an email
Brought to you by:
chris_humphreys,
mrbook
|
From: Martin V. <mv...@us...> - 2006-03-19 12:12:55
|
Hi Jon, Currently there is no (easy) way to create an attachment in-memory. The only way would be to create the whole message yourself with headers, mime markers, etc. and pass it to MrPostman as msg.raw.text in your script (see hotmail.script, but there we get the "raw" message directly from hotmail and do not construct it). As for embedded images just look at yahoo.script: Basically you have to set an id for the attachment and change the links to be something like <img src="cid:theattachmentid"/>. Martin Jon Denly wrote: > Hi all, > > I'm currently updating the outlook 2003 script and I have a couple of > questions about attachments. When receiving email, I am detecting if > the incoming email is an event invite and saving out the raw ICS > information to the filesystem as a file that is available via a local > web server and then creating a new attachment, refering to the URL of > the file. Once the email has been downloaded, the temporary > attachment can be deleted. I was wondering if there is a way of > creating an attachment entirely in memory, or possibly just with > access to a tmp directory? The way i'm implementing this currently is > shown below: > > # JD If this is a meeting invite, get the raw email using header > Translate=f, extract the invite as an ICS > # and add as an attachment > pattern_invite="\?Cmd=accept\" title=\"Accept\"" > found = match(page,pattern_invite) > if (found) > params[""] = "" > headers["Translate"] = "f" > status,page = get(replaceall(replaceall( msg.id > <http://msg.id>,"\\[","%5B"), "\\]", "%5D"),params,headers) > pattern_ics="(BEGIN:VCALENDAR.+END:VCALENDAR)" > icsfound,ics=match(page,pattern_ics) > > # Now write the ics file to a web shared folder to allow a > link to be added > # TODO find a better way of doing this, this is stupid > writefile("/Users/jon/Sites/mail/meeting.ics", ics) > msg.attachments[0].text="meeting.ics" > > msg.attachments[0].link="http://localhost/~jon/mail/meeting.ics > <http://localhost/%7Ejon/mail/meeting.ics>" > end > > Hopefully this code makes it clear what i'm currently doing. > > My second question is related to the first. I am trying to find a way > of displaying embedded images within emails. As it currently stands, > the embedded images are displayed in OWA as links relative to the > email. What I would like to do is download the images, create > attachments (hopefully in the same manner as above), and then rewrite > the email image links to link to the attachments from within the > email. Anyone have any ideas? > > Cheers, > > Jon > > PS - the wiki is currently unavailable: > > lib/WikiDB/backend/PearDB.php:32: Fatal[256]: Can't connect to > database: wikidb_backend_mysql: fatal database error > > * DB Error: connect failed > * ( [nativecode=Can't connect to MySQL server on > 'mysql.sourceforge.net <http://mysql.sourceforge.net>' (111)] ** > mysql://mrpostman:XXX...@my.../mrpostman > <http://mysql://mrpostman:XXX...@my.../mrpostman>) > > |