Access Gmail through a proxy ?
This is just a very rough idea. So rough that I decided it's best just to paste the code rather than even let you download it, unzip it just to see what it is. Basically, if (for whatever reason) you are stuck behind a proxy server that will not allow you to access your Gmail account, then have the following bit of code set up on your site. It uses the Gmail Atom Feeds, so only the subject line and date posted gets to be displayed - until Google changes this.
To be honest, I'm not behind a proxy so I can't test if this actually works, so ANY feedback is welcome. To see the code, click more.
<cfscript>
/**
* Convert a date in ISO 8601 format to an ODBC datetime.
*
* @param ISO8601dateString The ISO8601 date string. (Required)
* @param targetZoneOffset The timezone offset. (Required)
* @return Returns a datetime.
* @author David Satz ([email protected])
* @version 1, September 28, 2004
*/
function DateConvertISO8601(ISO8601dateString, targetZoneOffset) {
var rawDatetime = left(ISO8601dateString,10) & " " & mid(ISO8601dateString,12,8);
// adjust offset based on offset given in date string
if (uCase(mid(ISO8601dateString,20,1)) neq "Z")
targetZoneOffset = targetZoneOffset - val(mid(ISO8601dateString,20,3)) ;
return DateAdd("h", targetZoneOffset, CreateODBCDateTime(rawDatetime));
}
</cfscript>
<cfhttp url="https://gmail.google.com/gmail/feed/atom/" username="username" password="password here"></cfhttp>
<cfset gmailPosts = cfhttp.fileContent />
<cfset xmlPacket = xmlParse(gmailPosts) />
<cfset entries = xmlSearch(xmlPacket,"//:entry") />
<cfloop index="x" from="1" to="#arrayLen(entries)#">
<cfset node = structNew() />
<cfset node.title = entries[x].title.xmlText />
<cfset node.link = entries[x].link.xmlAttributes.href />
<cfif structKeyExists(entries[x],"content")>
<cfset node.description = entries[x].content.xmlText />
<cfelse>
<cfset node.description = "" />
</cfif>
<cfif structKeyExists(entries[x],"issued")>
<!--- Uses David Satz UDF from CFLIB.org --->
<cfset node.date = dateConvertISO8601(entries[x].issued.xmlText,0) />
<cfelse>
<cfset node.date = "1/1/1" />
</cfif>
<cfoutput>
<table width="200" border="1">
<tr>
<th scope="row">Date</th>
<td>#dateFormat(node.date, 'dd-mmm-yyyy')# #timeFormat(node.date, 'HH:mm:ss')#</td>
</tr>
<tr>
<th scope="row">Title</th>
<td>#node.TITLE#</td>
</tr>
<tr>
<th scope="row">Description</th>
<td>#node.DESCRIPTION#</td>
</tr>
<!--- The link is always is http://gmail.google.com/gmail - this might change
/**
* Convert a date in ISO 8601 format to an ODBC datetime.
*
* @param ISO8601dateString The ISO8601 date string. (Required)
* @param targetZoneOffset The timezone offset. (Required)
* @return Returns a datetime.
* @author David Satz ([email protected])
* @version 1, September 28, 2004
*/
function DateConvertISO8601(ISO8601dateString, targetZoneOffset) {
var rawDatetime = left(ISO8601dateString,10) & " " & mid(ISO8601dateString,12,8);
// adjust offset based on offset given in date string
if (uCase(mid(ISO8601dateString,20,1)) neq "Z")
targetZoneOffset = targetZoneOffset - val(mid(ISO8601dateString,20,3)) ;
return DateAdd("h", targetZoneOffset, CreateODBCDateTime(rawDatetime));
}
</cfscript>
<cfhttp url="https://gmail.google.com/gmail/feed/atom/" username="username" password="password here"></cfhttp>
<cfset gmailPosts = cfhttp.fileContent />
<cfset xmlPacket = xmlParse(gmailPosts) />
<cfset entries = xmlSearch(xmlPacket,"//:entry") />
<cfloop index="x" from="1" to="#arrayLen(entries)#">
<cfset node = structNew() />
<cfset node.title = entries[x].title.xmlText />
<cfset node.link = entries[x].link.xmlAttributes.href />
<cfif structKeyExists(entries[x],"content")>
<cfset node.description = entries[x].content.xmlText />
<cfelse>
<cfset node.description = "" />
</cfif>
<cfif structKeyExists(entries[x],"issued")>
<!--- Uses David Satz UDF from CFLIB.org --->
<cfset node.date = dateConvertISO8601(entries[x].issued.xmlText,0) />
<cfelse>
<cfset node.date = "1/1/1" />
</cfif>
<cfoutput>
<table width="200" border="1">
<tr>
<th scope="row">Date</th>
<td>#dateFormat(node.date, 'dd-mmm-yyyy')# #timeFormat(node.date, 'HH:mm:ss')#</td>
</tr>
<tr>
<th scope="row">Title</th>
<td>#node.TITLE#</td>
</tr>
<tr>
<th scope="row">Description</th>
<td>#node.DESCRIPTION#</td>
</tr>
<!--- The link is always is http://gmail.google.com/gmail - this might change