Title: Message
The topic has been reached numerous on this list so I thought I would share an idea I had earlier today that works great with everyone on this list.
 
Many of you have the idea's of writing your own parsers/interfaces for parts of declude or other parts of imail, but the biggest stump can be there is no easy way to check authentication against the IMAIL registry, or to integrate the features seamlessly into the imail/webmail interface.
 
Any developer can easily validate a session using an IMAIL session without ever needing or knowning the actual password of an account. I have commented my Cold Fusion authorization page [ cf_imail_login.txt ] so that no matter what language you code in you should be able to easily port.
 
For a working example feel free to check my "test" login I make available to this list.
http://mail.bsc.net/
login = [EMAIL PROTECTED]
pass = declude
 ( click the "Junkmail" button and you will be sent to an external server, but the interface is identical )
 
*Note: my working example builds heavily on the attachments I have included. I stripped everything down to the bare logic so everyone can use this to suit their needs.
 
If anyone else finds this information nearly as useful as I did today please let me know.
I'm sure this will make using the filters much much simpler for my users.
 
-Tom
 
 
 


    </center> <!-- END CENTER MAIL SUMMARY TABLE-->

  <p>&nbsp;</p>

</td></tr> <!-- CLOSE MAIN DOCUMENT CELL AND OPEN FOOTER CELL -->
<tr><td>

<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#3399FF">
<tr> <td><FONT FACE="Arial, Helvetica, sans-serif" SIZE=4>

    </font></font></td></tr>
</table>


<!-- CLOSE FOOTER COLOR CELL AND MAIN TABLE -->
</td></tr>
</table>

<!-- CLOSE BORDER CELL AND TABLE -->
</td></tr>
</table>
</body>
</html>   

How to link back into IMAIL from your web-application.

I recommand doing a CFINCLUDE for both your header 
and footer from within your CF Applcation.

To ensure your look fits, just find a webmail template 
that has as little text as possible, preferabally one with
maybe a one-line message to you. (such as no messages)
View source, save then replace as needed.

Here is an example of your links:

<a href="http://#mailip##imailuserkey#/logoff.#imailnumber#.cgi";>
<img src="http://#mailip##imailuserkey#/logoffbtn.gif"; border=0 alt="Logoff" 
width="74" height="24">
</a>





<!--- example header template used in CF to link back to IMAIL
      Note: I wrote my own template parser which uses double ## rather than singe
      which is what you will see in this example
 --->

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>

<TITLE>Mail Summary: Main</TITLE>

  <!--File: MSGSUM.HTML-->
</head>



<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0">

<a name="Top"></a>

<!-- THIS TABLE ENCLOSES THE ENTIRE PAGE CONTENTS WITH A COLORED BORDER-->

<table width="100%" border="0" cellpadding="5" cellspacing="0">
<tr> <td align="center" bgcolor="#3399FF">

<!-- THIS TABLE ENCLOSES THE ENTIRE PAGE CONTENTS -->
<!-- OPEN HEADER CELL -->

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <td align="center" bgcolor="#3399FF"><FONT FACE="Arial, Helvetica, sans-serif" 
SIZE=4><!-- HEADER MENU -->

<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td><FONT FACE="Arial, Helvetica, sans-serif" SIZE=4>
<b>Mailbox: Main</b>&nbsp;<a name="top">&nbsp;</a>&nbsp;&nbsp;
<font size="4">#chklogin.imailemail#</td>
<td><a 
href="http://##mailip####chklogin.imailuserkey##/logoff.##chklogin.imailnumber##.cgi";>
<img src="http://##mailip####chklogin.imailuserkey##/logoffbtn.gif"; border=0 
alt="Logoff" width="74" height="24"></a>
</font></font>
</td></tr>
<tr><td colspan="2"><FONT FACE="Arial, Helvetica, sans-serif" SIZE=4>

<!--Begin SumMenu.cgi This is not an IMAIL tag. Just info-->
  <a 
href="http://##mailip####chklogin.imailuserkey##/menu.##chklogin.imailnumber##.cgi?mbx=Main";>
    <img src="http://##mailip####chklogin.imailuserkey##/menubtn.gif"; border="0" 
alt="Menu"></a>
  <a 
href="http://##mailip####chklogin.imailuserkey##/readmail.##chklogin.imailnumber##.cgi?uid=##chklogin.userid##&mbx=Main";>
    <img src="http://##mailip####chklogin.imailuserkey##/checkmail.gif"; border="0" 
alt="Check Mail"></a>
  <a 
href="http://##mailip####chklogin.imailuserkey##/newmsg.##chklogin.imailnumber##.cgi?uid=##chklogin.userid##&mbx=Main";>
    <img src="http://##mailip####chklogin.imailuserkey##/composebtn.gif"; border="0" 
alt="Compose"></a>
  <a 
href="http://##mailip####chklogin.imailuserkey##/searchmail.##chklogin.imailnumber##.cgi?uid=##chklogin.userid##&mbx=Main&msg=1";>
    <img src="http://##mailip####chklogin.imailuserkey##/search.gif"; border="0" 
alt="Search Mail"></a>
  <a href="##script_name##?cpid=##cpid##&p=##p##&femail=##femail##&a=step2">
        <img border="0" src="http://CFServer.YourServer.Com/images/junkmail.jpg"; 
width="72" height="24">  
  </a><br>
<!--End SumMenu.cgi-->

</font>
</td></tr>
</table>

<!-- END HEADER MENU -->



</td></tr>  <!-- CLOSE HEADER CELL AND OPEN MAIN DOCUMENT CELL -->
<tr><td bgcolor="#FFFFFF" align="center"><FONT FACE="Arial, Helvetica, sans-serif">

<BR>


In order to link to our external mail server correctly a 
few alterations to the IMAIL templates must be made.

I personally do not use the default IMAIL templates and 
have not in a long time. I use the Atlantic template available at
http://www.ipswitch.com/Products/IMail_Server/template.html
All my examples are based on that template, I do not know if 
or how different other templates may be.

Files I had to edit: 
menu.html
summenu.html
readmail.html

Locate the section which draws your menu across the top
( if you can't figure out where on your own you shouldnt be reading this )

Add something like this to your menu bar across the top:
<a 
href="http://CFMserver.yourdomain.com/junkmail/imaillogin.cfm?ImailUserKey=<!--IMAIL.UserKey-->&ImailNumber=<!--IMAIL.Number-->&ImailEmail=<!--IMAIL.UserID-->@<!--IMAIL.CurrentDomain-->&targetURL=junkmail.htm">
<img border="0" src="http://CFMserver.yourdomain.com/junkmail/button.jpg"; width="72" 
height="24"></a>

[ menu.html ]
Originally my menu.html did not display their full email address,
just their userID, but my validation page expects to find their email address
 ( to ensure the customer does not alter the URL to snoop someone else's mailbox )
Old:
  <font size="4"><!--IMAIL.UserID-->
Changed to:
  <font size="4"><!--IMAIL.UserID-->@<!--IMAIL.CurrentDomain-->




That's all the editing required to your Imail Templates



<!--- this should be set in application.cfm, global variable-->
<CFSET mailip = "192.168.1.12:80">
 
<!--- preset auth variable to false --->
<cfset AuthPass = 0>
 
<!--- ensure our variables are defined --->
<CFPARAM NAME="ImailuserKey" DEFAULT="X">
<CFPARAM NAME="ImailNumber" DEFAULT="1">
<CFPARAM NAME="ImailEmail" DEFAULT="[EMAIL PROTECTED]">
<CFPARAM NAME="targetURL" default="junkmail.htm">
 
<!--- URL of IMAIL "main menu page" --->
<cfset imURL = "http://#mailip##imailuserkey#/menu.#imailnumber#.cgi?mbx=Main";>
 
<!--- get the "main menu" from IMAIL webmail on bhalf of user
      if their UserKey was valid, we should see their mailbox summary
      including their email address on the page. If the Userkey was invalid
      We will get a login page, in which case the search below will fail
 --->
<cfhttp url="#imurl#" method="GET" port="80" resolveurl="false"></cfhttp>
<cfset IMHTML = cfhttp.filecontent>
 
<!--- 
  search for BOTH the email address and the words "mailbox summary" 
  in the page we got back from IMAIL if *BOTH* are not found on 
  the page we must have been redirected to the login screen (invalid name/pass)
  or someone is trying to forge some information 
  --->
<CFIF FindNoCase(ImailEmail,IMHTML) AND FindNoCase("Mailbox Summary",IMHTML)>
 <CFSET AuthPass = 1>
</CFIF>
 
 
<CFIF AuthPass IS 1>
 <!--- 
      AUTH PASSED! Setup your session variables here 
      and store the IMAILxxxx variables for later use
  --->
        <CFLOCATION URL="#targetURL#">
<cfelse>
 <!---
      AUTH FAILED!
      This should NEVER happen during a normal session.
      Most likely some wise guy thought he could alter the login URL.
      Print whatever you like to the screen and give up.
 --->
</CFIF>
 

Reply via email to