package coremailapi; import tebie.applib.api.APIContext; import tebie.applib.api.IClient; import java.net.Socket; classe publique CoremailApi { ret APIContext privé; cli IClient privé; private String providerId; private String orgId; private String userId; private String domainName; private String userEmail; private String serverip; socket socket privé = null; public CoremailApi (String providerId, String orgId, String userId, String domainName, String serverip) { this.providerId = providerId; this.orgId = orgId; this.userId = userId; this.domainName = domainName; this.userEmail = userId + "@" + domainName; this.serverip = serverip; try { socket = new Socket (serverip, 6195); cli = APIContext.getClient (socket); } catch (Exception e) { e.printStackTrace (); } } // 创建 用户 void createUser () { try { ret = cli.createUser (providerId, orgId, userId, "domain_name =" + domainName + "& cos_id = 1 & user_status = 0"); } catch (Exception e) { e.printStackTrace (); } } // 修改 用户 密码 essayez { ret = cli.changeAttrs (userEmail, "true_name =" + userId + "& password =" + passwd); if (ret.getRetCode () == 0) { System.out.println (userEmail + "Le mot de passe de l'utilisateur a été modifié" ); } else { System.out.println (userEmail + "Échec de la modification du mot de passe utilisateur"); System.out.println ("code:" + ret.getRetCode ()); System.out.println ("Msg:" + ret.getErrorInfo ()); } } catch (Exception e) { e.printStackTrace (); } } // Authentification unique de l'utilisateur void userLogin () { try { ret = cli.userLogin (userEmail); if (ret.getRetCode () == 0) { String sid = ret.getResult (); System.out.println (userEmail + "的 单 点 登录 链接 :"); System.out.printf ("http: //%s/coremail/main.jsp? Sid =% s \ n", serverip, sid); System.out.printf ("http: //%s/webadmin/~%s/~/usr/index_usr.jsp \ n", serverip, sid); } } catch (Exception e) { e.printStackTrace (); } } }
Authentification unique pour l'ajout et la modification des utilisateurs de coremailAPI mailbox
Je suppose que tu aimes
Origine blog.51cto.com/11732619/2677444
conseillé
Classement