Results 1 to 4 of 4

Thread: [SOLVED] Preauth and compose in the same time.

  1. #1
    Join Date
    Nov 2010
    Posts
    6
    Rep Power
    4

    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

  2. #2
    Join Date
    Jan 2010
    Posts
    138
    Rep Power
    5

    Default

    I guess the value of the redirectURL param should be URL encoded since it contains special chars like '?' and '&'.

  3. #3
    Join Date
    Nov 2010
    Posts
    6
    Rep Power
    4

    Default

    Thanks, but "URL encoded", I'm ont sure to understand

  4. #4
    Join Date
    Nov 2010
    Posts
    6
    Rep Power
    4

    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 !

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •