Ejemplo n.º 1
0
        private static void StartImport(string[] lines)
        {
            foreach (var item in lines)
            {
                var _row = item.Split(',');
                if (_row.Length == 4)
                {
                    var fullName    = _row[0];
                    var mailboxName = _row[1].Split('@').FirstOrDefault();
                    var domainName  = _row[1].Split('@').LastOrDefault();
                    var password    = _row[2];

                    double quota = -1;
                    double.TryParse(_row[3].Trim(), out quota);

                    var addEmailResult = _client.AddMailBox(domainName.Trim(), mailboxName.Trim(), password.Trim(), quota, "", "", fullName.Trim());

                    if (addEmailResult.ErrorCode == 0)
                    {
                        Console.WriteLine("Email Added: {0}", _row[1]);
                    }
                    else
                    {
                        Console.WriteLine("Error: {1}, {0}", addEmailResult.Message, _row[1]);
                    }
                }
            }
        }