List administration

ArrowUk
Posts: 4
Joined: Fri Apr 09, 2010 2:02 pm

List administration

Postby ArrowUk » Fri Apr 09, 2010 2:52 pm

Hi,

I am having a few problems with lists. I have a C# application that populates lists from a database - it has been working fine up until a few weeks ago. The only thing that has changed is a new post office with a very similar name. For example, I have example.co.uk with several lists (one including members@) I then added example.ie with one list (members@). My application can no longer find the lists - I've been trying to find a solution for days and I am stuck!

Here is some code (although it was working a few weeks ago):

Clear the lists

Code: Select all

                            MailEnable.Administration.ListMember listMember = new MailEnable.Administration.ListMember();
                            listMember.AccountName = POSTOFFICE;
                            listMember.ListName = this.meLists[i];

                            int result = listMember.FindFirstListMember();
                            Console.WriteLine("Initial Status: " + result);//returns 0 now
                            while (result == 1)
                            {
                                result = listMember.RemoveListMember();
                                listMember = new MailEnable.Administration.ListMember();
                                listMember.AccountName = POSTOFFICE;
                                listMember.ListName = this.meLists[i];
                                result = listMember.FindFirstListMember();
                            }
                            Console.WriteLine("Cleared " + this.meLists[i] + " list");


Add members to lists

Code: Select all

        public int addMemberToList(String postoffice, String listName, String email)
        {
            if (listExists(postoffice, listName))
            {
                MailEnable.Administration.ListMember listMember = new MailEnable.Administration.ListMember();
                listMember.AccountName = postoffice;
                listMember.Address = "[SMTP:" + email + "]";
                listMember.ListMemberType = 0;
                listMember.ListName = listName;
                listMember.Status = 1;

                return listMember.AddListMember();
            }
            throw new Exception("List " + listName + ", PO: " + postoffice + " does not exist");  //this is getting thrown by the application
        }

        protected Boolean listExists(String postoffice, String listName)
        {
            MailEnable.Administration.List oList = new MailEnable.Administration.List();
           
            oList.AccountName = postoffice;
            oList.ListName = listName;

            Boolean listExists = (oList.GetList() == 1); //this returns 0
            oList = null;
            return listExists;
        }


As I have said I am absolutely stuck on this problem - I have no idea what to do. Do you think the similar named postoffice's could be creating problems? I don't want to delete the users and start again really!

If you need any more information just let me know (it's my first post), thanks in advance.

ArrowUk
Posts: 4
Joined: Fri Apr 09, 2010 2:02 pm

Re: List administration

Postby ArrowUk » Mon Apr 19, 2010 12:07 pm

Just incase anyone comes across this post with the same problem, I have came up with the following solution:

My MailEnable is running from a MySQL database so the lists are sored in the database, I then do the following:

  • Pull out all my lists - (list name and mailbox must mach MailEnable naming)
  • Loop through my lists
  • Delete the records from the list_member table in the MailEnable database that match the current list
  • Select the DISTINCT email addresses from my tables that subscribe to the current list
  • Insert the records into the list_member table
  • Continue the loop with the next email address

Hope this helps someone - let me know if you would like some code etc.

Also if you are running MailEnable from files (rather than a DB) the lists are stored in text files (comma or tab delimited?) - so you could easily output to a file instead of the database.

Who is online

Users browsing this forum: No registered users and 1 guest