public static void DelMailBoxInstruct(string dName, string uName) { try { XMLayer xm = new XMLayer(); xm = XMServer.CreateXMLayer(); string raw = string.Empty; string line = string.Empty; string res_lines = string.Empty; xm.Login(); raw = xm.GetMailProcTab(dName, uName); StringWriter sw = new StringWriter(); using (StringReader sr = new StringReader(raw)) { while ((line = sr.ReadLine()) != null) { if (!line.Contains("mailbox")) { sw.WriteLine(line); } } } xm.SetMailProcTab(dName, uName, sw.ToString()); xm.Logout(); } catch (Exception error) { Log.WriteException(error); } }
public static bool GetMailBoxInstruct(string dName, string uName) { try { XMLayer xm = new XMLayer(); xm = XMServer.CreateXMLayer(); string raw = ""; string line; xm.Login(); raw = xm.GetMailProcTab(dName, uName); xm.Logout(); using (StringReader sr = new StringReader(raw)) { while ((line = sr.ReadLine()) != null) { if (line.Contains("mailbox")) { return(true); } } } } catch (Exception error) { Log.WriteException(error); } return(false); }
public static RedirectionsList GetRedirections(string dName, string uName)// { RedirectionsList result = new RedirectionsList(); result.forwards = new List <string>(); result.activeForwards = new List <string>(); try { XMLayer xm = new XMLayer(); xm = XMServer.CreateXMLayer(); string raw = ""; string line; xm.Login(); raw = xm.GetMailProcTab(dName, uName); xm.Logout(); using (StringReader sr = new StringReader(raw)) { string[] data; int i = 0; while ((line = sr.ReadLine()) != null) { line = line.Trim(); if (line == ".") { break; } data = extractMailProc(line); switch (data[0]) { case "redirect": for (i = 1; i < data.Length; i++) { result.forwards.Add(data[i]); } break; case "lredirect": for (i = 1; i < data.Length; i++) { result.activeForwards.Add(data[i]); } break; default: break; } } } } catch (Exception error) { Log.WriteException(error); } return(result); }
public static string[] GetMailProcTab(string domainName, string userName) { string[] result = new string[2] { "", "" }; XMLayer xm = new XMLayer(); try { xm = XMServer.CreateXMLayer(); xm.Login(); string raw = xm.GetMailProcTab(domainName, userName); xm.Logout(); string line; result[0] = ""; result[1] = ""; string[] id; using (StringReader sr = new StringReader(raw)) { while ((line = sr.ReadLine()) != null) { line = line.Trim(); if (line == ".") { break; } id = extractMailProc(line); line = line.Trim(); switch (id[0]) { case "mailbox": case "redirect": case "lredirect": result[0] += line + "\r\n"; break; default: result[1] += line + "\r\n"; break; } } } } catch (Exception error) { Log.WriteException(error); } return(result); }
public static string GetAdvanced(string dName, string uName) { string content = ""; XMLayer xm = new XMLayer(); try { xm = XMServer.CreateXMLayer(); xm.Login(); string raw = ""; string line; raw = xm.GetMailProcTab(dName, uName); xm.Logout(); using (StringReader sr = new StringReader(raw)) { string[] data; while ((line = sr.ReadLine()) != null) { line = line.Trim(); if (line == ".") { break; } data = extractMailProc(line); switch (data[0]) { case "mailbox": case "redirect": case "lredirect": break; default: content += line + "\r\n"; break; } } } } catch (XMailException error) { Log.WriteException(error); } return(content); }
public static void SetMailBoxInstruct(string dName, string uName) { try { XMLayer xm = new XMLayer(); xm = XMServer.CreateXMLayer(); string raw = ""; xm.Login(); try { raw = xm.GetMailProcTab(dName, uName); } catch (XMailAdminProxy.XMailException) { } raw = "\"mailbox\"\r\n" + raw; xm.SetMailProcTab(dName, uName, raw); xm.Logout(); } catch (Exception error) { Log.WriteException(error); } }