Very cool stuff here if you have version 3.8 or higher.
So I write this in a couple of short hours after referring to the knowledge base. I actually opened a ticket for help with decoding, but then I searched for decode in the KB and found help, so I saved a support credit.
This allows me to send photo e-mail from my phone to an account on my mail server set up just for Aestiva to connect to. I use netmail tags to connect to the server, get the message, decode it, remove the message from the mail box, and update the contents of my site. I can the script to run daily in a cron job, or just execute the script from my phone's web browser to update the photoblog.
The only issue is the lower left of the decoded pictures always comes out messed up. If anyone can chime in on how I can resolve that small issue, I'd be grateful.
You can see the result on the front of my personal testing site - www.khanhdom.com
<< # HTML/OS Version 3.8 is required for Base64 Decoding. This script assumes every e-mail has a jpg attachment. /#
blogdb="/databases/sites/khanhdom/photoblog" popserver="mail.khanhdom.com" poplogin="*****@khanhdom.com" poppassword="**********" tempmaildir="/temp/" imgdir="/images/photoblog/" authemail="**********@vzwpix.com"
# Open Connection to Server /# popstat=NETMAILOPEN(1,popserver,poplogin,poppassword,60) poplist=NETMAILGETLIST(1)
# If there are more than 0 messages found /# IF poplist[1,1]="TRUE" AND poplist[2,1]>0 THEN # Get the first message /# popstat=NETMAILGETMSG(1,1,tempmaildir,500000,1000)
# Get file name of retrieved mail /# mailfile=tempmaildir+popstat[2,1] mailfrom=popstat[4,1] mailsubject=popstat[5,1] maildate=popstat[6,1] mailto=popstate[7,1]
# Process message only if it comes from the trusted address /# IF mailfrom=authemail THEN # Rip out body of message/# COPY FILE=MAILFILE TO tempmailstring /COPY mailbody=chopleft(tempmailstring,CR+LF+CR+LF) mailbody=trimleft(mailbody)
# Delete Verizon crap from message /# mailbody=chopleft(mailbody,".txt"+CR) mailbody=cut(mailbody,".txt"+CR) mailbody=chopright(mailbody,"This message") mailbody=cut(mailbody,"This message") mailbody=trim(mailbody)
# Extract encoded image and decode to file system /# attachment=chopleft(tempmailstring,"/9j/") decodestat=BASE64DECODE(attachment,imgdir+"mailtemp.jpg")
# If file decoded fine, add article in blog /# IF decodestat[1,1]="TRUE" THEN PHOTO_DATE=maildate PHOTO_DESC=mailbody PHOTO_STATUS="ACTIVE" addstat=dbadd(blogdb) # Move decoded file to a file named after the new record /# movestat=SYSMV(imgdir+"mailtemp.jpg",imgdir+addstat[2,1] + ".jpg") /IF /IF
# Delete temporary maile file /# delfile=SYSRM(mailfile)
# delete the first message /# popstat=NETMAILDELMSG(1,1) /IF
# Close Server Connection /# popstat=NETMAILCLOSE(1) >>
<HTML> <<mailfile>><BR> <<mailfrom>> / <<authemail>><BR> <<mailsubject>><BR> <<maildate>><BR> <<mailto>><BR><BR>
<<mailbody>> <HR> <<decodestat>> </HTML>
|
   Overview
   MCSE
   CCNA
HTML/OS
   XML and RSS    Remove all HTML Photoblogging
SWITCH SIDES |