JangoMail FAQs

Web Database Connection

JangoMail can connect to a web database, or roughly speaking, we can connect to your database over the internet. This requires us knowing the IP address of the database server, the database name, a database username, and that user’s password. Additionally, you have to place a “helper” file on your server, the exact version of which depends on the type of database you want JangoMail to connect to.

In this example, we’re connecting to a MySQL database. Specifically, it is a MySQL database hosted at HostMonster within my jangodemo.com account. Obtain the connector/helper file from within your JangoMail account. Create a new database, select Internet Web Database, and click the icon/image for your database type. For the MySQL example here, it’s the one on the right. A w_4.php file will be downloaded, and then place that file into your domain’s root (public_html) directory.

mysql_jangomail_file_setup

mysql_w4file

Before trying to connect JangoMail to your database (or as a troubleshooting step), ensure you can connect to your table(s) of interest via a remote connection from elsewhere. For this test, I used Navicat for MySQL (it comes with a 14-day free trial). When running your database client, you should be able to connect to your database and query whatever from a table. You should also be able to do the same if you are in a hosting environment, typically using phpMyAdmin or some other tool/utility your hosting provider shows in its cPanel.

From within Navicat for MySQL, create a new connection:

mysql_connection

After connecting to the database of interest, you can create tables as needed (not covered here). In the picture below, I have collector tables for the JangoMail event API feature, along with some other tables.

mysql_connection_display

Let’s say I want to connect to the Contacts table from JangoMail. With some data in that table…

mysql_contacts

…I can go into my JangoMail account and create the connection profile and add the query to select from the table:

mysql_jangomail_setup

Test the connection, and if successful, click Save. To access the database while creating a new message, connect to the database in the Databases tab, and once the data is pulled, you’ll be taken to the Messages page.

mysql_connect

All three records were pulled based on the query. If you need to filter your data, then edit the query to reflect what you need via a WHERE clause.

mysql_messages