Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
Go Back   Zimbra :: Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra :: Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-17-2011, 09:57 AM
Junior Member
 
Posts: 6
Default [SOLVED] Preauth and compose in the same time.

Hi,

I have a little question about preauth.

I want to create a link who use preauth and redirect the user to the compose view with an email adresse in the field recipient.

So I use this script :

PHP Code:
<?php
   
    $PREAUTH_KEY
="0f6f5bbf7f3ee4e99e2d24a7091e262db37eb9542bc921b2ae4434fcb6338284";
    
$WEB_MAIL_PREAUTH_URL="http://zimbra.server.com/service/preauth";
        
    
$user $_GET["user"];
    
$domain=$_GET["domain"];
        
    
$email "{$user}@{$domain}";

    if(empty(
$PREAUTH_KEY)) {
        die(
"Need preauth key for domain ".$domain);
    }
    
    
$timestamp=time()*1000;
    
$preauthToken=hash_hmac("sha1",$email."|name|0|".$timestamp,$PREAUTH_KEY);
    
$preauthURL $WEB_MAIL_PREAUTH_URL."?account=".$email."&by=name&timestamp=".$timestamp."&expires=0&preauth=".$preauthToken;


    
/*Redirection vers la page de création de mail avec comme destinataire admin@xxx.com*/
    
$preauthURL .= "&redirectURL=/zimbra/?view=compose&to=admin@xxx.com"
    
    
$lien="<a href=".$preauthURL.">Cliquez ici</a>";
?>

So with the link generated, I should be authentified and redirected on the page to create a new message, with the field recipient pre-filled with : admin@xxx.com


But it doesn't work, I'm redirected on the home page of my zimbra mailbox :/


Why zimbra can't do these two actions ? (preauth, then redirect on compose view with a recipient pre-filled).

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-17-2011, 11:59 PM
Zimbra Employee
 
Posts: 70
Default

I guess the value of the redirectURL param should be URL encoded since it contains special chars like '?' and '&'.
Reply With Quote
  #3 (permalink)  
Old 04-18-2011, 12:04 AM
Junior Member
 
Posts: 6
Default

Thanks, but "URL encoded", I'm ont sure to understand
Reply With Quote
  #4 (permalink)  
Old 04-18-2011, 12:41 AM
Junior Member
 
Posts: 6
Default

It works !!! Thanks I use this website to encode my redirect URL :

URL Decoder/Encoder

And now, it works great

Thanks a lot I put this question on the french forum 2 month ago, nobody could help me, and you, in one day, you solve the problem !
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

blog.zimbra.com




 

SEO by vBSEO ©2011, Crawlability, Inc.