Mautic Cron Job

My first email with mautic didn’t go as planned.  Once again waking up I looked at the results and nothing had been sent.  The problem this time however was of a technical nature.

Setting up Cron Jobs

My crontab now looks roughly like this.  You will need to change the paths to match your mautic install.

* * * * * php /var/www/html/mautic/app/console mautic:segments:update

 */4 * * * * php /var/www/html/mautic/app/console mautic:campaigns:rebuild

 */5 * * * * php /var/www/html/mautic/app/console mautic:campaigns:trigger

 0,30 * * * * php /var/www/html/mautic/app/console mautic:emails:send

15 5 * * 5 /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log


These cron jobs are all necessary for mautic to do it’s job.  The first syncs email addresses in all the segments, rerunning the filters.  The second updates any campaigns, and the third, which I was was missing, triggers events in campaigns.  The fourth is only necessary if you queue emails.  You may want to do that if you have outgoing mail restrictions on your hosting, but linode does not. I put it there anyway for future proofing.

The last job in my crontab will auto renew my lets encrypt certs.  To add these to your cron jobs just run the command crontab -e.  It will ask you to select an editor (vim ftw but you can use nano if you want).


Go ahead and copy paste one of those commands into a terminal and make sure it runs.  In my case it didn’t, since I didn’t have permission to write everything in that directory.  Everything in there belonged to both group and user www-data (the user php executes as).  This may have been some mistake I made during installation, but nonetheless if  you run across it here is what I did:

cd /var/www/html
sudo chmod -R g+w mautic
sudo usermod -aG www-data breandan

Embedding Coupon Codes in Links

I tried this:

The idea is to embed this javascript into your theme, then you can add coupon codes directly to URLs.  This means in your marketing emails you can have a “click here to buy at 50% off” link.  Also good for “Free Plus Shipping” offers on adwords.

The tutorial works mostly without a hitch but wasn’t applying the discount.  The trick was that my theme was slightly different.  The <form> tag didn’t have the id=”cartform” element in it that is required for the last snippet of javascript.  Add that to the form and it worked.  I’m using “simple” theme BTW.

Getting past the spam filter

So I wrote my first email with Mautic.  The interface is a bit clumsy compared to Mailchimp, but it’s useable and better than I would do if I had built it.  So I test sent it to myself and it went straight to the spam folder.  I googled a bit and found the following resource very useful:

This site will give you information about why your email is being marked as spam.  The major thing is authentication.  Go to this site, then send a test email to the address it asks for, then you will see “your not fully authenticated” as one of the reasons.  Authentication happens through DKIM and SPF entries in your DNS settings.  I still haven’t set up DKIM but SPF was quick and easy.  Click on the plus sign next to “You’re not fully authenticated”  You will see an entry [SPF] Your server {ip address} is not authorized to use {your email address}.  It will have an entry for SPF record to enter.  You will now need your opensrs login.  You needed this to set up email for your shopify domain before.  If you never did that you should look into that anyway.  Getting the opensrs login requires emailing support.  They will get back to you quickly with some links describing how to set up email, and a reset password link for opensrs.

Login to opensrs, then click “Name Servers/DNS” at the top nav bar.  Click “Modify DNS Zone”.

If you didn’t know this already this is also where you would define a subdomain and point it at your linode.

Now under TXT records, paste the text from into the field labeled “Text”.  Leave the Subdomain blank.  Click “Add Record” then click  “save dns zone”.  In my case this was all it took to get through the spam filters.


I mentioned in a post before that I had found a solution to replace mailchimp.  The solution to which I was referring is called Mautic. Mautic is a fairly ambitious marketing automation tool.  It can do email marketing, forms, analytics, social media marketing and more.  It is built on symfony and supports plugins.  A marketplace will soon be available to sell plugins as well.

Mautic is available as an open source package that you can install on your own server.  There is also a free cloud hosted option, with a caveat.  The free cloud hosted version does not let you import CSV lists for your email contacts.  That was a deal breaker for me since I needed an easy way to import my lists from shopify.  At some point I’ll try to make a cron job or a plugin for shopify or mautic or something to sync the lists, but I need an easy import option in the mean time.

I chose Linode  for the hosting of my mautic instance.  At some point I’ll go through the whole server set up, but honestly it was kind of complicated for me and to be sure I don’t miss anything I’ll have to set up and test a brand new one.  That’s a little more effort than I’m up for tonight so I’ll just outline the basic process:

  • Sign up for linode and prepay a small amount by credit card (you will only need the lowest option of 5 dollars a month
  • Create a new “linode” (virtual machine)
  • Point a domain at it: Assuming you have a domain name for your shopify store, you can define a subdomain and point that at your server.
  • install OS image of your choice (I used ubuntu server because it’s what I run on my desktop so I’ve set up LAMP on it before)
  • install apache, php, and mysql
  • install postfix
  • install mautic:
  • follow these instructions to enable https and get signed certificates from letsencrypt:  THIS STEP IS ABSOLUTELY REQUIRED.  If you do not use HTTPS you will not be able to include the tracking code in your shopify theme.
  • Get the tracking code from your mautic instance and paste it into theme.liquid on your shopify site

You are now good to go.  In our next post we’ll be looking at sending out our first email.

Bad Experience with Mailchimp

If you’ve spent any time reading e-commerce advice you’ve probably read that the ROI on email marketing is by far the highest of any type of marketing.  Some entrepreneurs entire strategy is to advertise squeeze pages in order to build a list, and the email list drives all profits.

Well the entire purpose of building this business was to learn internet marketing.  Obviously I have to get in on this email thing.

Mailchimp comes up when you read anything about email marketing.  I signed up and they provided a pop up sign up form.  As of this writing I have about 20 email addresses on my list.  I then wrote a quick email.  It had some fun facts about space followed by a clumsy segue to Fountain pen history.

The next morning I was excited to login and see if anyone opened my email.  What I found was I had been suspended for an alleged TOS violation.

An automated system had flagged my email.  I can only think that since my fun fact was the atmospheric pressure on the surface of Venus and my email contains the phrase “this pen is” multiple times that it decided an email about cheap fountain pens must be adult content.

This happened a week ago today.  I now have a solution I will post about but it’s rather complex and deserves a post of it’s own.

Status to Date

This blog is  a bit late to the game so I’ll write down the status as I remember things now first.  A few months ago I was upset about being turned down for yet another awesome sounding job.  Feeling upset, angry, and determined that there had to be a way out of the soul killing office drama of the corporate welfare state, I turned to youtube for home business ideas.  This isn’t my first foray into ecommerce web sites.  My past attempts at businesses had always failed (I’ll write a post on failed businesses later, along with some musings).

I read The Four Hour Work Week, Entreprenerd, Ca$hvertising, and How to Fail at Everything and Still Win Big.  All of this in some sort of effort to discover the keys to success in business.  It turns out the main thing is: You have to sell something, for money.

So I went back to an old idea of mine: open a stationery store.  I looked at more youtube videos, and decided this time would be different.   Instead of getting lost in the details of web hosting, dealing with payment gateways and server issues myself, I would just pay the people at shopify.  So far so good.  Now I need suppliers.  I have a fair bit of experience finding suppliers who aren’t scammy on Alibaba, but I continued too far down the easy path instead.  I decided I was just going to drop ship directly from China.

Some people have had great luck with drop shipping supposedly.  I am not one of those people.  I made my first sale in a week or two (sale actually being a “free plus shipping” offer).  Out of the first 4 sales made, 2 asked for refunds because shipping took so long that they thought the items were lost.  I gave them their refunds and let them keep the items, since I’m not a total dick.

So now I went and ordered a few of each item, keeping it at my house.  I’ve been replacing aliexpress orders of a few pieces for dhl-shipped orders from the suppliers themselves.  I’ll write a post at some point about building supply chain.

The bulk of this blog is notes to myself though.  It will be a series of comments about marketing experiments, lessons learned, and some how-tos when something technical comes up.