Announcement

Collapse
No announcement yet.

User creation with remote (hosted) imap/smtp server

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • User creation with remote (hosted) imap/smtp server

    Hi,

    I have a general question regarding the user creation with an imaplogin to a hosted email server (provider).
    In the documentation there is a given example:

    Code:
    createuser -c 1 -A oxadmin -P admin_password -u testuser \
    -d "Test User" -g Test -s User -p secret -e testuser@example.com \
    --imaplogin testuser --imapserver 127.0.0.1 --smtpserver 127.0.0.1
    Due to the fact on my pure Debian there is no email functionality at all I tried to replace the localhost with the imap and smtp server of the provider (lets say Gmail, so imap.gmail.com and smtp.gmail.com).

    The user creation went through with no errors but when I login I receive an error message that there is no connection to the mail server. In the log I see the following:

    Code:
    =SERVICE_DOWN Message='Connection was refused or timed out while attempting to connect to remote server imap.gmail.com for user xyz@gmail.com.' exceptionID=428524280-38
    When I checked the configuration of the added email account I see that port 143 and 25 has been used. There is no listener on the ports at Google. As it is not editable I can not check "use SSL" to verify. So I assume that it would work but as the ports are blocked...

    Maybe I misunderstand or can not link the given information from the documentation together but I would assume that it is in general possible to create a user that is linked to a hosted (remote) email server (e.g. --imaplogin testuser --imapserver imap.gmail.com --smtpserver stmp.gmail.com) and/or edit the configuration of the mail account.

    Furthermore I assume that the login then would be IMAP. Right?

    Could you please advise?

    Thank you in advance!

  • #2
    Yes, as you found out you can configure almost any external IMAP and SMTP server per user.
    As authentication you would use IMAP but this is not implicitely. You still have to configure it properly with imapauth.properties.

    As parameter for imapserver and smtpserver you can specify the full URI like
    --imapserver imaps://imap.gmail.com:993
    (I'm not sure this the correct information for GMail but just an example)

    Comment


    • #3
      Perfect. Thanks for the information. I will try out and give an feedback.

      BR

      Comment


      • #4
        Hello,

        I was able to configure an external IMAP/SMTP account:
        Code:
        --imapserver imap.gmail.com:993 --smtpserver smtp.gmail.com:587
        However I am not able to login. I see that imap authentication was successful for the user but get a message that the account was not found:

        Code:
        com.openexchange.authentication.imap.impl.IMAPAuthentication.handleLoginInfo(IMAPAuthentication.java:358)
        Imap authentication for user [email]xyz@gmail.com[/email] successful on host imap.gmail.com:993
        Code:
        CTX-0010 Categories=USER_INPUT Message='Context "gmail.com" cannot be found.' exceptionID=-1540765390-3
        GUI:
        Code:
        The account "gmail.com" was not found. (CTX-0010)
        I assume(d) that this is related to the @-sign. So I have changed the following:

        com.openexchange.mail.loginSource=mail (mail.properties) but with no luck.

        My imapauth.properties looks like this:
        Code:
        IMAP_SERVER=imap.gmail.com
        IMAP_PORT=993
        IMAP_USE_SECURE=true
        USE_FULL_LOGIN_INFO=true
        USE_FULL_LOGIN_INFO_FOR_USER_LOOKUP=true
        USE_MULTIPLE=false
        com.openexchange.authentication.imap.imapAuthEnc=UTF-8
        Would really apriciate if you could help to sort it out.

        Thank you in advance!
        BR

        Comment


        • #5
          After self-study I think I have solved the issue.

          You have to have the same name for account as for the email-address you use to authenticate to an IMAP server with. So the user is then know in the context.

          For example:
          Code:
          createuser -c 1 -A oxadmin -P admin_password -u [B]testuser@gmail.com[/B] \
          -d "Test User" -g Test -s User -p secret -e [email]testuser@gmail.com[/email] \
          --imaplogin [B]testuser@gmail.com[/B] --imapserver imap.gmail.com:993 --smtpserver stmp.gmail.com:587
          Additionally it is necessary to adjust theses values in imapauth.properties (as you said) otherwise it will cause some problem with the @-sign.
          Code:
          USE_FULL_LOGIN_INFO=false
          USE_FULL_LOGIN_INFO_FOR_USER_LOOKUP=true
          Correct me if I am wrong.

          Thank you!
          BR
          Last edited by oxox; 04-21-2016, 09:08 PM.

          Comment


          • #6
            You are basically right. The whole story of login strings, context, and user names is more complex though. If it's working for you as it is, everything is fine ;-)

            Comment


            • #7
              Originally posted by Wolfgang Rosenauer View Post
              You are basically right. The whole story of login strings, context, and user names is more complex though. If it's working for you as it is, everything is fine ;-)
              Thank you!

              Comment


              • #8
                Wolfgang,

                Just wondering if it is possible to change the authentication type in case the imap server can not be reached (e.g. "Couldn't connect to host") as a backup scenario. So the user can still access his files, contacts etc.?

                Thank you for clarification!
                BR
                Last edited by oxox; 04-26-2016, 04:40 PM.

                Comment


                • #9
                  There is no fallback like this implemented in the default authentication plugins.
                  To achieve it, an own implementation would be required for the plugin.

                  Comment


                  • #10
                    Thank you, Wolfgang!

                    Comment

                    Working...
                    X