Using Mautic Automated Marketing on an Alibaba Cloud Instance with DirectMail

简介: In this tutorial, we will install Mautic on a LEMP stack, using the Webinoly Optimized server automation tool.

By Jeff Cleverley, Alibaba Cloud Tech Share Author

Mautic is the world's largest Open Source marketing automation project, with over 1000 contributors to the project. It is available in 35 languages and used by over 200,000 organizations.

Effective marketing campaigns use a network of multiple channels and involve a lot of repetitive tasks with interrelated complexities. Mautic, and other similar software, are powerful tools that make these complex and repetitive tasks easy. Marketing automation software tracks every lead, or visitor to your website and other online locations, and analyzes visits to build a profile of visitors and automates actions based upon their activity. Integrations with popular Customer Relationship Management (CRM) software provide a constant stream of high quality leads ready to be converted into sales and clients.

Marketing Automation is like a bridge between your leads and your customers.

Mautic provides a mechanism to develop and target multi-channel marketing resources, from dynamic web content and landing pages, forms, automated email engagement and marketing, to web notifications, text messages, tweets, and social monitoring. It has integrations with third party platforms including Salesforce CRM, Sugar CRM, Microsoft Dynamics CRM, Zoho CRM, FullContact, MailChimp, ConnectWise, and many more. Since it is open source, it is also completely customizable with a healthy developer community building all manner of other integrations.

Mautic is built on Symfony, the highly popular and extremely performant PHP framework, and will run on either a LEMP or LAMP stack.

In today's tutorial we are going to install Mautic on a LEMP stack, using the Webinoly optimized server automation tool. We will then set up an Alibaba Cloud DirectMail email account to use as the SMTP provider for Mautic emailing.

I will be using a root user to issue commands in the examples. If you are not using the root user, please remember to issue the sudo command before each command where root privileges are necessary.

In the code and command examples I will be using 'example.com' as the domain. This will need to be replaced by your own domain when you follow along. In the images used to illustrate each step, I have used a free domain I had available 'duang.party', again remember in your commands use your own domain.

Before you begin this tutorial, you should have an Alibaba Cloud ECS instance provisioned and running, with at least 1GB of memory.

You should have uploaded your public SSH key to the server during provisioning so that you can access your server by SSH in the terminal. If you haven't done this before, you can find instructions in this tutorial.

You should also have a domain name available to use.

Step 1. Open Security Group Ports

If you have created your instance, you should be viewing it in your Alibaba Cloud ECS Management Console. Locate 'Security Groups' from the left horizontal navigation bar and click it to go to your Instance's Security Group:

1

<Click Security Groups on your Instances Page>

You should now see your security group in the Security Group list. Locate the 'Configure Rules' option at the right of your security group row, and click it.

2

<Choose Configure Rules for your Security Group>

You will now be taken to a page with two tabbed panels. One tab will show you your Inbound Security Group Rules, the other will show you the Outbound rules.

Inbound Rules

Webinoly Requires the following inbound Ports open:

• 22/22 (SSH)
• 80/80 (HTTP)
• 443/443 (HTTPS)
• 2222/2222 (Webinoly Tools)

Each Port should be using the following further settings:

Authorization Type: Address Field Access
Authorization Object: 0.0.0.0/0

When you have completed this, your Security Group Rules Inbound tab should look like:

3

<Security Group Inbound Ports>

Outbound Rules

Webinoly and Mautic require the following outbound Ports open:

• 22/22 (SSH)
• 25/25 (SMTP)
• 80/80 (HTTP)
• 443/443 (HTTPS)
• 11371/11371 (Access GPG Keys)

Each Port should be using the following further settings:

Authorization Type: Address Field Access
Authorization Object: 0.0.0.0/0

When you have completed this, your Security Group Rules Outbound tab should look like:

4

<Security Group Outbound Ports>

Step 2. Configure Alibaba Cloud DNS

Now we need to go to the Alibaba Cloud DNS management section of your console, you can find this in the left horizontal main menu. Inside the Basic DNS section, click the blue 'Add Domain' button in the top right to add your domain:

5

<Open Alibaba Cloud DNS>

6

<Add your domain>

Your domain will appear in the list. Now you need to configure some DNS records for it:

7

<Configure DNS Records for your domain>

You will need to add at least two records. An 'A' record for '@' (all) host, with the value of your Instance public IP address. And a 'CNAME' record for 'www' host, with the value of your domain name.

Your Domain's DNS settings should look similar to this:

8

<Configure your A and CNAME DNS records>

If you are using a domain with Alibaba Cloud Domains, then you should be finished here.

If you are using a domain registered with a third party domain registrar, you will need to log in to your account at your domain registrar and change your domain's nameservers (DNS servers) to point to the Alibaba Cloud nameservers.

You will find the correct nameservers provided at the top of your DNS records page:

9

<Make sure your domain nameservers are set to the Alibaba Cloud DNS servers>

Step 3. Configure Alibaba Cloud Direct Mail

In your Alibaba Cloud Console Home, locate 'Direct Mail' and click it:

10

<Alibaba Cloud Direct Mail in your Cloud Console>

Add an Email Domain

In the Direct Mail overview panel, first click on Email Domains in the left horizontal navigation:

11

<Choose Email Domains first>

The click the 'New Domain' button in the top right:

12

<Click to create a New Domain>

You will need to add a domain. To avoid conflicts with your main domain email, choose a subdomain to use. I suggest prefixing your domain with 'dm.':

13

<Add a subdomain to use for Direct Mail>

Your new Email Subdomain will appear in the list. You now need to click configure:

14

<Click configure to get your Direct Mail Verification records>

A new window will open, it will provide you with several DNS records you need to set in your Alibaba Cloud DNS records for your domain. These are used for verification, and for receiving and tracking configuration:

15

<Alibaba Cloud Direct Mail provides you with additional DNS records>

Now go back to Alibaba Cloud DNS, and enter each of these records and their values in your domains DNS records.

Once you have added these records your domains DNS should look similar to this:

16

<Add the Additional DNS records to your Domains DNS>

Now you are ready to verify ownership of the email domain. Return to your email subdomain in Direct Mail and click verify:

17

<Click Verify in your Direct Mail email domain>

Assuming everything has been configured properly, your domain status should change to 'verification successful', highlighted in green:

18

<Email domain verification successful>

Add Sender Address and Set SMTP Password

Now open the Sender Addresses panel and click Create Sender Address:

19

<Sender Addresses panel - Create Sender Address>

Choose your email domain from the dropdown menu.

You will need to add an account name. This name will be used to create the sender address. This will be your SMTP username in the following format:

<Sender Account Name>@<Email Subdomain>

You will also need to set a Reply-To address. This is not the Reply-To address used by SMTP in Mautic, it is only used for communication with the Alibaba Cloud console, but it must be verified before you can progress and set up your SMTP password.

Next chose your mail type. You can choose either 'Triggered Emails' or 'Batch Emails'. In real world usage of Mautic, you would set up both, Triggered Emails for transactional emails, and Batch Emails for Email newsletters and mass mail-outs. For the purposes of this tutorial I will choose 'Triggered Emails'.

20

<Set your Direct Mail sender address>

Direct Mail will immediately send an email to the Reply-To address you set. You will need to go to your email inbox and click a link before you can proceed further.

Once you have verified your email, click on the 'Set SMTP Password':

21

22

<Set your SMTP Password>

You will also require the the Alibaba Cloud Server Addresses when you set up Mautic. These can be found here.

For the Singapore region the server address is currently:

smtpdm-ap-southeast-1.aliyun.com

Step 4. Install Webinoly LEMP Stack

Webinoly is an excellent tool that automates the installation of an optimized LEMP web server stack on any Ubuntu 16.04 Instance. It installs Nginx, MariaDB (MySql) and PHP7, alongside command line tools to automate the provisioning of Let's Encrypt SSL Certificates, FastCGI Static Caching, Redis and Memcached Object Caching servers, and logging tools to help manage your server stack.

Install the full Webinoly LEMP stack to your instance with the following command:

# wget -qO weby qrok.es/wy && bash weby 3

Once Webinoly has completed its installation, you will be provided with the root and admin user passwords for your MariaDB MySQL database. Please make a record of them, you will need them:

23

<Webinoly has been installed>

Step 5. Create Virtual Host & Root Directory

With Webinoly it is incredibly easy to configure your Nginx Virtual Host for your site.

Issue this command:

# site example.com -php

Webinoly will quickly respond with a success message:

24

<Create a site and virtual host with Webinoly>

Webinoly has now created the directory structure and root directory for your site, and configured the Nginx virtual host configuration file necessary to run a PHP based site from it.

Your Nginx Virtual host configuration file is located at '/etc/nginx/sites-available/' and has been automatically symlinked into '/etc/nginx/sites-enabled/'.

You can open it to inspect it with:

# nano /etc/nginx/sites-available/example.com

25

<Webinoly automatically configures your Nginx Virtual Host>

Your site root directory has been created at '/var/www/htdocs/'.

Step 6. Obtain an SSL Certificate with Webinoly

To obtain a Let's Encrypt SSL certificate and enable HTTPS on your domain with Webinoly, issue the following command:

# site example.com -ssl-on

You will be asked to provide an email address and a cron job will be created to automatically renew your certificate every week.

26

<Obtain a Let's Encrypt SSL with Webinoly>

Since Webinoly uses Certbot by Let's Encrypt, your Nginx Virtual Host Configuration file will be automatically updated to serve your site using HTTPS (port 443).

Step 7. Create your Mautic Database

Login to your MariaDB (MySQL) using your the root password provided earlier (when Webinoly completed installation):

# mysql -u root -p

Now create your database and the user you require by entering the following successive MySQL commands:

CREATE DATABASE mastic DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
GRANT ALL ON mastic.* TO 'new_user'@'localhost' IDENTIFIED BY 'new_users_password';

Make sure you choose a strong password. Once you have done this, flush privileges and exit MySQL:

FLUSH PRIVILEGES;
EXIT;

27

<Create your Mautic Database>

Step 8. Download Mautic Files

Change directory into your site's root directory, and download the latest Mautic ZIP archive:

# cd /var/www/example.com/htdocs
# wget https://www.mautic.org/download/latest -O mautic.zip

28

<Download the latest Mautic release>

Finally, unzip the archive:

# unzip mautic.zip

Step 9. Prepare Mautic Directory permissions

First, from within the root directory, delete the 'mautic.zip' archive, and then list out the directory with ownership and permissions:

# rm mautic.zip
# ls -l

You will see that currently all of the Mautic directory contents are owned by the 'root' user:

29

<Root user still owns all the Mautic Files and Directories>

We need to make the web server user and group 'www-data' the owner of all of these files and directories.

Do that with the following command, and then list out the directory again to ensure everything has been successful:

# chown -R www-data:www-data /var/www/example.com/htdocs
# ls -l

Now you should see 'www-data' as the owner of the root directories contents:

30

<www-data now owns the directory and its contents>

Step 10. Install and Configure Mautic

We have prepared everything we need, now we just need to run the Mautic installer, to do that just visit your domain:

https://example.com

Mautic will do an environment check, and let you know when it is ready to install:

31

<Mautic Installer Environment Check>

Next you will need to provide the installer with your database details. Enter the database settings for your Mautic database:

32

<Connect Mautic to your database>

Now we create an Administrative user:

33

<Create your Admin account>

The final step in the Mautic installer set up is the email configuration. These settings can be changed later from within Mautic, but we can set them up now.

Choose your sender and sender email.

For mail transport, select 'Other SMTP server'

Choose how you want Emails handled, immediately or queued.

In Server, enter the Alibaba Cloud Direct Mail server you will be using. You can get that server address here.

Choose Port 465 and SSL Encryption and Login Authentication mode.

Enter the SMTP username and Password you created in Step 3 above.

34

<Configure Mautic to use Direct Mail - Then click next step>

Mautic will take you to its dashboard and we are ready to start automating our marketing!

If you want to check that Direct Mail is working. Click on the Settings Icon in the top right, then on Email settings. There is a Green 'Test Connection' button, click this. If everything is working perfectly you will get a success message.

35

<Test Direct Mail in the Mautic Admin settings>

That's it! Mautic is an impressive platform that is constantly growing. Find out more here.

相关实践学习
每个IT人都想学的“Web应用上云经典架构”实战
本实验从Web应用上云这个最基本的、最普遍的需求出发,帮助IT从业者们通过“阿里云Web应用上云解决方案”,了解一个企业级Web应用上云的常见架构,了解如何构建一个高可用、可扩展的企业级应用架构。
MySQL数据库入门学习
本课程通过最流行的开源数据库MySQL带你了解数据库的世界。 &nbsp; 相关的阿里云产品:云数据库RDS MySQL 版 阿里云关系型数据库RDS(Relational Database Service)是一种稳定可靠、可弹性伸缩的在线数据库服务,提供容灾、备份、恢复、迁移等方面的全套解决方案,彻底解决数据库运维的烦恼。 了解产品详情:&nbsp;https://www.aliyun.com/product/rds/mysql&nbsp;
目录
相关文章
|
Kubernetes 关系型数据库 MySQL
Helm入门(一篇就够了)
Helm入门(一篇就够了)
876 0
|
数据采集 数据挖掘
kettle开发-数据清洗之字符串替换
kettle开发-数据清洗之字符串替换
1173 2
|
分布式计算 关系型数据库 MySQL
DolphinScheduler安装部署
DolphinScheduler安装部署
2059 0
|
算法框架/工具
成功解决INFO: pip is looking at multiple versions of keras-preprocessing to determine which version is c
成功解决INFO: pip is looking at multiple versions of keras-preprocessing to determine which version is c
|
10月前
|
存储 弹性计算 Linux
阿里云服务器新手购买及操作指南(图文教程)
阿里云服务器新手购买及操作指南(图文教程)对于新手而言,选购阿里云服务器需结合使用场景、成本预算和配置需求综合判断,核心需关注购买方式、配置参数两大维度,以下为具体参考:
|
Prometheus 监控 Cloud Native
Docker 部署 Prometheus 和 Grafana 监控 Spring Boot 服务
Docker 部署 Prometheus 和 Grafana 监控 Spring Boot 服务实现步骤
1074 0
|
云安全 存储 人工智能
美的X阿里云:加速出海!
美的X阿里云:加速出海!
818 4
|
SQL 关系型数据库 MySQL
MySQL8 窗口函数
MySQL 8 引入了窗口函数,这是一种强大的分析工具,可以在查询结果集中执行计算而无需将数据分组到多个输出行中。本文介绍了窗口函数的基本概念和使用方法,并通过几个实际案例展示了如何使用窗口函数进行成绩和排名统计、销售数据分析等操作。
1030 1
MySQL8 窗口函数
|
消息中间件 Prometheus 监控
RabbitMQ性能调优指南
【8月更文第28天】RabbitMQ 是一个非常流行的消息队列中间件,它支持多种消息协议,并且可以轻松集成到各种系统中。随着应用的扩展,确保 RabbitMQ 在高负载环境下能够高效稳定地运行变得至关重要。本文将深入探讨如何通过配置、监控以及最佳实践来优化 RabbitMQ 的性能。
2634 1