• About Morris Development
  • A Focus for Cloud Efficiency
    • Microsoft Azure
    • Amazon Web Services
  • What our Clients Say
  • Our Products
    • PreschoolDB
    • WebinarDB
  • Contact Us

Morris Development

Custom System Development and Integration

April 7, 2015

Back-End Integration with Bulk Mail Services

One of the most common mistakes made by developers of internal database systems is the failure to leverage existing toolsets, attempting to handle everything internally. For simple tasks, this is often the best solution. However, bulk mailing for marketing is not something your ERP system or CMS should be handling directly. There are a wide variety of bulk email services, but I’ve found MailChimp to be the most flexible of all. It has both a simple and flexible user interface as well as an API serving multiple platforms. From a security perspective, it is ALWAYS best to keep marketing people out of areas where non-marketing data may be.

I’ve written a few simple scripts to show you how to add or update information from your private database to a MailChimp server. The client system I’m working with is written in ASP.net with VB.net as the code-behind. The module being used is MailChimp.net.

Once you’ve installed the package, you can simply import the libraries

Imports MailChimp
Imports MailChimp.Lists
Imports MailChimp.Helper

In our case, we needed our internal database of parents to link to a mailing list. We simply made a function to search for the email in a MailChimp list, then either update it or add a new record.

Dim email As New EmailParameter                       
Dim mc As New MailChimpManager(api)
Dim list As ListResult = mc.GetLists()
Dim listid As String = list.Data(0).Id
Dim mergeVars As New MergeVar
mergeVars("FNAME") = txtParent1First.Text
mergeVars("LNAME") = txtParent1Last.Text
mergeVars("new-email") = txtParent1Email.Text

Dim match As Matches = mc.SearchMembers(txtParent1EmailOriginal.Text, listid)
If match.ExactMatches.Members.Count = 0 Then
    email.Email = txtParent1Email.Text
    mc.Subscribe(listid, email, mergeVars, "html", False)
Else
    email.Email = txtParent1EmailOriginal.Text
    mc.UpdateMember(listid, email, mergeVars)
    txtParent1EmailOriginal.Text = txtParent1Email.Text
End If

So here’s what’s happening:

MailChip keeps emails in lists. So each list has subscribers. Each subscriber has a key, but the standard “find” (SearchMembers) is by email.

All the variables associated with the record as held in a custom object called “MergeVar”

In our case, we are simply updating the first/last names of the parents as well as their emails.

Article by MacGyver / MailChimp, Web Developer

About MacGyver

I've worked with database systems for over 20 years, and started my own company in 2000. Almost all my business consists of internal database systems, either ERP or CRM. My programming is primarily in Angular / Microsoft C# and MS SQL.

About This Site

Morris Development has been specializing in internal database system design and integration since 1999. We provide long-term management and support of secure data systems for many businesses as well as developing the more complex code structures for ERP systems like Intellievent, Apidas, and AVMS.

This site is primarily for our developers to keep track up various technologies and updates that are used by Morris Development.

Training

Integrating Angular Microsite with .Net

Private Data Caching with Google Storage

Continuous Deployment for Production Releases?

Azure Websites – the perfect Angular host

Angular 2

  • Angular 2 Authentication
  • Angular Command Line Interface
  • Material Design for Angular
  • Using Observables in Angular 2

Mentors

  • Ben Nadel
  • Dan Wahlin
  • Deborah Kurata
  • John Papa

Staff

  • Dan Morris

Training

  • Google Development Courses
  • Microsoft Virtual Academy
  • PluralSight
  • Test Deep Links

© 2025 · Morris Development