Resending dropped emails in Mailgun

I use a custom setup of Mailgun and Mailtrain to send out my newsletters. Recently I had an issue with sending out my latest newsletter, and came up with a solution I figured I would like to share.

My small issue with Mailgun & Mailtrain

Now don’t get me wrong, Mailgun + Mailtrain is a fantastic combo and saves me hundreds of dollars when sending out newsletters. If your’e not using it – you should be! I have encountered a small issue with it though…

Because I’m using the Mailgun basic shared IP plan, I sometimes get issues related to other users sending out spam. This can cause the shared IP to become blacklisted on some hosts. This is usually not an issue, as Mailgun will rotate out bad IP Addresses when it is made aware of them. In the case of my last newsletter though, it wasn’t apparent the IP Address was bad until after it had been sent. The outcome of this was thousands of undelivered messages. Mailtrain also doesn’t currently support failed messages, so there was no easy solution here… πŸ™

Redelivering undelivered messages in Mailgun

There is a handy workflow to redeliver messages, but it’s a little cumbersome when heres more than a handful of messages to redeliver…

resending failed messages in Mailgun
resending failed messages in Mailgun

Not a problem I thought… Mailgun is built for dev’s and has fantastic API’s I could use to do a mass redelivery… Whilst the API is comprehensive, there is no simple way to do exactly what I needed. πŸ™

Build a custom app!

Whenever I encounter a problem, I’ll build an app to solve my issue. I have a couple of custom apps i’ve built which make my life easier. And, all of the apps I do sell, are ones i’ve needed myself at some point in time.

So I didn’t go as far as I could have. And settled on just parsing all the logs for the data I needed to resend the Newsletter via MailTrain. If I was super keen, I would have used the API to also resend the messages… but that will have to wait for another day…

GetFailedMailGunEmails macOS app

I figured others may find this useful, so I’ve uploaded the app the Github with a permissive MIT license for others to hack away at:
https://github.com/sweetppro/GetFailedMailGunEmails It’s written in Objective-C, as I still prefer it to Swift…

GetFailedMailGunEmails screenshot

The biggest problem with the Mac App Store

So, I’m in the midst of a Mac App Store related support nightmare right now…
I uploaded an important update to Cookie yesterday (v5.8.1), and in my haste (it was a long day, and I uploaded it around 2am) it had a receipt checking bug.
Cookie Icon
https://itunes.apple.com/us/app/cookie/id1048338802?ls=1&mt=12

Now, normally this wouldn’t be a problem, as this particular bug should be easily caught in Apple’s own review system. The only real harm is having to upload a fixed binary and wait through the review process again. But, somehow the corrupted build made it through review, and in the the hands of thousands of customers
πŸ™

My own Store

Now if something like this were to happen in my own store, I can easily send out an update virtually instantly. In the case of the Mac App Store, I’m at the mercy of another companies time schedule and review system. Not really the best situation to be in….

I uploaded the fix around 16hrs ago, and it’s currently being reviewed right now. Fingers crossed it goes through quickly.
πŸ™

My apologies to all those affected.

#deletefacebook

Its been a long time coming, and i’ve thought about it often. But seeing Elon Musk delete his companies facebook accounts finally gave me the push I needed to do the same. I deleted fb off my iPhone months ago, and havn’t missed it. Just recently ive found myself wasting more time on their platform on my desktop though…. something which I don’t like. So after hearing the news on Musk was all I needed to make the leap.

I couldn’t be happier.

heres a helping hand for those waiting to do the same
https://www.facebook.com/help/delete_account

creating EDM in GarageBand

So I was a little bored yesterday, and figured I’d really like to try making some edm (electronic dance music). I watched a couple of youtube tutorials, updated Garageband – and dove right in.

EDM

My favourite style of music is Electronic music, and within this genre, I really like progressive and dark house. I find this really nice to workout and just generally zone out too. It was natural then that I was always going to make something which included all these elements. I spent a total of maybe 5hrs playing around with loops and twiddling knobs.

Im actually reasonably happy with my creation – considering I really had no idea what I was doing.
πŸ™‚

here’s a link to the track on Soundcloud:

Email marketing with MailTrain in Plesk Onyx

So I ran in to a few small issues getting an email marketing solution based on MailTrain running in Plesk Onyx. Nothing show stopping – but I figured I’d archive this here, so no one else has to waste a full day getting it all configured just right. πŸ™‚

Email marketing – A problem in search of an answer

A little background…. I’m not the best at email marketing (or social media…. etc…), but figured I should really get a little more proactive. So the first problem was how to send out a large number of emails without totally destroying my email reputation. Day one was spent researching, looking at some saas services (MailChimp, SendInBlue etc), some WordPress plugins (Newsletter, MailPoet etc) and some paid apps (Sendy). The problem with all these solutions, was that none of them were cheap (most are subscription payment based), and worse some were downright extortionate. So whats a dev to do… get on GitHub of course! A couple of apps were discovered – a Rails app, and a Node.js app. Both were tested, but I settled on the Node.js app: MailTrain.

I fired it up on my dev machine, and had it running in a matter of minutes! so far so good. even better – it had all the features I wanted already – no custom code to write – awesome! and best of all it’s free to use.

Well, whats MailTrain?

MailTrain

shamelessly taken directly form the GitHub page
MailTrain is a self hosted newsletter application built on Node.js (v7+) and MySQL (v5.5+ or MariaDB).

FEATURES
Mailtrain supports subscriber list management, list segmentation, custom fields, email templates, large CSV list import files, etc.”

nice!

Installing on Plesk Onyx

I figured it would be super easy to install on Plesk, just like a rails app. Well, it was, mostly. But there was a couple of small issues I ran into which had me going round in circles for hours…
πŸ™

Enable Node.js

So ok, first of all we need to enable Node.js on Plesk. super easy:
Open the Tools and Settings tab

the Tools and Settings Panel in Plesk
the Tools and Settings Panel in Plesk

then click on Add/Remove Components

add new components into Plesk
add new components into Plesk

Scroll down and expand the Web Hosting menu, then enable NodeJS support

enabling Node.js support in Plesk
enabling Node.js support in Plesk

Crete a mysql database

Go back to the Websites & Domains tab and select your domain where you want to install MailTrain.
Click Add Database

adding a new database for MailTrain
adding a new database for MailTrain

Create a new database user

creating a new database in Plesk
creating a new database in Plesk

take note of the Database name, user and password – we’ll need these for configuring MailTrain.

Configure MailTrain

We need to give access to the database, and this is super easy.
If you haven’t done it yet, download MailTrain from GitHub
unarchive the zip file, and navigate to the config folder
duplicate the default.toml file and rename the new file production.toml
open the newly created production.toml file and replace the contents with this:

# production.toml
[mysql]
host=”127.0.0.1″
user=”your_username”
password=”your_password”
database=”your_database_name”

Ok, so normally this would be all we’d need to do. But I ran into an install issue, and had to add a custom script to to the package.json file.

Open up the file: package.json
add these two lines to the end of the scripts array:
“installposix”: “npm install posix”,
“stop”: “pkill –signal SIGINT mailtrain”

The installposix script is the one we need to get MailTrain to install correctly in Plesk Onyx. And the stop script is just a convenience script.

So your package.json will look something like this:

editing the package.json file
editing the package.json file

Cool, now we can upload MailTrain to our server.

Configure Node.js app in Plesk

click on the Node.js icon under our domain, and update the variables to this:
Document Root /”your_domain”/mailtrain/public
Application Mode production
Application URL http://”your_domain”
Application Root /”your_domain”/mailtrain

configuring the Node.js settings
configuring the Node.js settings

We have already enabled Node.js support globally, but now we need to enable Node.js on the domain where we want MailTrain running. This is super easy (like everything in Plesk Onyx). just click the Enable Node.js button

Install all the required dependencies for MailTrain

Normally we would just hit the NPM Install button, and our app would be running! but this is where those custom script we added to the package.json file come in handy.
Click the Run Script button, type installposix in the field, and hit Run. For some reason we need to install this manually or else the build fails. once it completes dismiss the script panel and hit the NPM Install button.

We’re almost, but not quite there, and this step tripped me up for hours…

One last thing

Well actually two things….
drop back out of the Node.js settings to your domain name, and open up the Apache & nginx Settings panel. Add the following code in Both the HTTP, and HTTPS fields:

ProxyPass http://”your_server_IP_address”:3000/
ProxyPassReverse http://”your_server_IP_address”:3000/

hit Apply

settings custom Apache Directives
settings custom Apache Directives

Head back to the Node.js panel one last time. Open the Run Script panel, enter start, then hit Run. then dismiss the panel

running custom scripts in Plesk for our custom Email marketing setup
running custom scripts in Plesk for our custom Email marketing setup

Success – affordable and reliable email marketing

MailTrain should now be running on your domain!
you can get it configured to send out your newsletter by following the tutorials in the Wiki.

Accessing a subdomain hosted Rails app via a folder on the root domain in Plesk Onyx

I ran into just this problem the other day. I was migrating my Rails store from a CPanel VPS over to the current Plesk Onyx VPS. It took me a while to figure out a solution, so I figured I’d write a blog outlining the steps I took to get my desired result.

The problem

For the sake of simplicity, I like to host my Store as a subfolder of my root domain. ie… sweetpproductions.com/store. In Cpanel, this was pretty easy to set up, as I just added a symlink from sweetpproductions/store to the Rails app directory. I soon found out, this is not the case in Plesk. Trying to get symlinks working lead me on a path of frustration ultimately leading to a dead end.

Rails on Plesk

Plesk Onyx takes the pain out of setting up Rails apps. In fact it was almost too easy, and I wasn’t sure if I was missing something. In contrast, setting up my Rails app in CPanel involved delving into manually installing various components via the command line. This ease of use however comes at a price. I quickly discovered that I simply could not get the Rails app installed into a subfolder, and still have the root domain accessible. ie.. sweetpproductions.com. So after many attempts and duckduckgo searches, I decided that my best bet was to…

Run the app on a subdomain!

Simple enough, right. Installing Rails in the root of a domain(or subdomain) is a breeze in Plesk. Just take a look at the tutorial over here. OK nice, but now I need to set up some kind of rewrite so that my app is accessed from sweetpproductions.com/store, and NOT store.sweetpproductions.com.

Rails installation on subdomain in Plesk Onyx
Rails installation on subdomain in Plesk Onyx

Apache Alias to the rescue

Lets add an Alias on the root domain to the subdomain, to map the requests for sweetpproductions.com/store to store.sweetpproductions.com.
We do this from the Apache & nginx Settings tab.
Scroll to the bottom of the page, and paste the following code into both Additional directives for HTTP and Additional directives for HTTPS

Alias /store /var/www/vhosts/sweetpproductions.com/store.sweetpproductions.com/rails_store/public

So far so good, now we have the site structure we want. But the rails app just won’t load πŸ™ We still need to configure a few more things to get it working correctly.

Configure Ruby on the root domain!

This may seem counter intuitive, but this is what we need to do to get our setup working. We won’t actually install the app on the root domain, but we do need a Ruby instance running. Let’s configure Ruby with the same settings as the Ruby install on the subdomain. Take care to make sure that the Ruby version and application mode are identical on the subdomain and root domain.

Rails installation on root domain in Plesk Onyx
Rails installation on root domain in Plesk Onyx

Now we need to grab some information from the system to enable our app to run correctly. To do this, we need to…

Enable SSH access

This is super easy on Plesk. In the root domain manager, click on FTP Access.
Then on the FTP Accounts tab – add a new user (if you dont have one already) and enable Access to the server over SSH via bin/sh. Now let’s log into the server and get the info we need. We need to configure Ruby on the root domain to load our subdomain hosted rails app with the correct Ruby and Passenger installs. First of all let’s get the location of our Passenger install with the following command:
which passenger-config
taking note of the result:
/usr/bin/passenger-config

We use the output from this command, to find our Ruby location:
/usr/bin/passenger-config –ruby-command
passenger-config was invoked through the following Ruby interpreter:
Command: /opt/plesk/ruby/2.3.1/bin/ruby
Version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
To use in Apache: PassengerRuby /opt/plesk/ruby/2.3.1/bin/ruby
To use in Nginx : passenger_ruby /opt/plesk/ruby/2.3.1/bin/ruby
To use with Standalone: /opt/plesk/ruby/2.3.1/bin/ruby /usr/bin/passenger start
 
The following Ruby interpreter was found first in $PATH:
Command: /var/www/vhosts/sweetpproductions.com/.rbenv/versions/2.3.1/bin/ruby
Version: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
To use in Apache: PassengerRuby /var/www/vhosts/sweetpproductions.com/.rbenv/versions/2.3.1/bin/ruby
To use in Nginx : passenger_ruby /var/www/vhosts/sweetpproductions.com/.rbenv/versions/2.3.1/bin/ruby
To use with Standalone: /var/www/vhosts/sweetpproductions.com/.rbenv/versions/2.3.1/bin/ruby /usr/bin/passenger start

Configuring Ruby and Passenger

From these two commands, we have now have all the info we need to build our Apache rules.

  • The result from our first command is our PassengerRoot variable.
  • PassengerRuby is found in the output from the second command.
  • In our case we want our store loading at sweetpproductions.com/store, so both PassengerBaseURI and RailsBaseURI will be /store
  • PassengerAppRoot is the root location of our app
  • Directory is the location of the public folder in our app

So now lets re-edit our Apache rules on the root domain to get the rails app working.
Alias /store /var/www/vhosts/mrqwirk.com/store.mrqwirk.com/rails_store/public
PassengerRuby /opt/plesk/ruby/2.3.1/bin/ruby
PassengerRoot /usr/share/passenger/phusion_passenger/locations.ini
RailsEnv development
PassengerEnabled on
<Location /store >
PassengerBaseURI /store
PassengerAppRoot /var/www/vhosts/mrqwirk.com/store.mrqwirk.com/rails_store
</Location>
<Directory /var/www/vhosts/mrqwirk.com/store.mrqwirk.com/rails_store/public>
RailsBaseURI /store
AllowOverride all
Options -MultiViews
</Directory>

Apache & nginx Settings on Plesk Onyx for root domain
Apache & nginx Settings on Plesk Onyx for root domain

Success! now our store is loading just fine when we navigate to sweetpproductions.com/store πŸ™‚
We have just one final touch for completion, we need to…

Redirect requests from the subdomain to the root domain

To do this we open up the subdomain in Plesk and add the following code into Additional directives for HTTP and Additional directives for HTTPS on the Apache & nginx Settings tab.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.sweetpproductions\.com
RewriteRule ^(.*)$ http://sweetpproductions.com/%1 [L,NC,QSA]

Edited 17 Oct 2017
Using the previous rewrite rule created an issue with updating the Let’s Encrypt SSL/TLS Certificate. The new rewrite rule below, adds an exception for the .well-known/acme-challenge/ folder, so that Let’s Encrypt can correctly validate:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.sweetpproductions\.com
RewriteCond %{REQUEST_FILENAME} !\/\.well-known\/acme-challenge\/
RewriteRule ^(.*)$ http://sweetpproductions.com/%1 [L,NC,QSA]

Apache & nginx Settings on Plesk Onyx for subdomain redirect to root folder
Apache & nginx Settings on Plesk Onyx for subdomain redirect to root folder

Done!

Now when anyone visit’s our site at sweetpproductions.com/store they will be shown our rails store. And also if anyone tries to visit store.sweetpproductions.com they will be redirected to our preferred loaction at sweetpproductions.com/store.

Posted originally posted Aug 19, 2017 – updated Oct 17, 2017

App Store review macOS and iOS review nightmares

So for the past 3 weeks I have been literally banging my head against a wall with the App Store review process and the cryptic illogical rejection reasons.

App Store review

I am normally quite happy with the App Store review process, and my apps are normally all reviewed and available within 24hrs. However just recently I have had the mis-fortune of feeling the pain many other iOS/macOS devs speak of. Two of my apps; Cookie 5 and Bitcoin Convert have both taken 3 weeks to be approved and ready for sale. Although both for entirely different reasons, both updates were delayed for what seemed like an eternity….

Cookie 5

Cookie is a privacy related macOS app I sell which provides cross browser Cookie management. The reasons for the delay on this being accepted are a complete mystery. I received no feedback whatsoever for 3 weeks… hmm, I guess there was some internal disputes over wether this directly competes with Safari 11’s new anti tracking measures? But I’ll never really know, and I can only speculate.

After 2 weeks I actually removed Cookie from review and re-submitted, as I thought it had maybe been “forgotten about”. But after going into App Store review, it once again just sat there – in limbo – for another week. Finally this morning, I woke up surprised to it see it approved.

It wasn’t too much of an issue, as the new build wasn’t a critical one. But still super annoying. I waited a week before giving up and releasing the non-Mac App Store version. So for 3 weeks, there was a difference between the Mac App Store version and the version from my own Store.

Cookie stuck in App Store review purgatory for 3 weeks!
Cookie stuck in App Store review purgatory for 3 weeks!

Bitcoin Convert

Now this is where the fun begins…
So I originally had a few iOS crypto coin currency converters, and decided why not build a couple of the more popular ones. I ended up with 6 in total; Bitcoin Convert, Doge Convert, Ethereum Convert, Litecoin Convert, Ripple Convert and Dash Convert.

Bitcoin Convert rejected 6x by App Store review
Bitcoin Convert rejected 6x by App Store review

They were all free apps, with the exception of Bitcoin Convert, which is a 99c app. The 2 new ones (Ripple Convert & Dash Convert) were rejected as SPAM as Apple said they were all similar apps with minimal differences. Fair enough, I told my self, so I set about updating Bitcoin Convert to include the function of all the other crypto apps. I even added in a number of other popular crypto coins to make it even more useful. Apple was informed that I was doing this. They accepted the two new coin apps on the grounds that I would remove all from sale once Bitcoin Convert had been updated as a container app.

The big update

So, I finished the update to Bitcoin Convert, and submitted it without issue. After a day or two I had some reports of crashing coming in, and narrowed it down to locale issues. More specifically, Bitcoin Convert was choking in locales with a , as the decimal separator. Oh no! I fixed it up right away, and uploaded the fix to Apple for review.

Rejection

The first time it was rejected, It wasn’t entirely surprising. I still hadn’t removed my other crypto apps from sale yet. So I promptly did this and deleted them from my account – just to be sure.

Bitcoin Convert was resubmitted with a note explaining the other app removals. I figured the update would take a another day to go through review again. And that would be that… Boy, was I so wrong… The next 3 weeks involved rejection after rejection stating that it was similar in function to other apps in my account. They also stated that I needed to convert it into a container app!
Weird, I thought that’s what I’d just done…

Not once did I change the binary. The same build was resubmitted every time, with notes pleading my case to Apple review. Screenshots of my account were attached as proof to show the other apps were no longer in my account. I appealed the rejection, and waited around a week for a ph call. In the meantime, I thought I must have missed something, so I logged into my Dev Account and also removed the deleted apps provisioning profiles. The app was rejected 2x more whilst waiting for that ph call.

Early morning ph Call

So, while my company is US based, I currently live in Australia. 2am Thursday morning I woke to the sound of my ph ringing. I scrambled to answer before they gave up and put me back in the ph queue. To their credit, the call was very courteous. Adam assured me that yes I was in fact correct, Bitcoin Convert was in fact a container app and would finally accepted. Yay! success. I still didn’t really believe though – but was pleasantly surprised to se it finally accepted today also.

In the 3 weeks since, my app has received a number of 1 star reviews which I have been powerless to do anything about. At least I can actually reply to the reviews on the App Store now, and let ppl know whats going on. But still. Not cool.

Ah well, it is Apple’s store and it gets to make it’s own rules…

Street performing and the use of a LIMO

So, I like street performing and have been doing so now for a number of years. Its taken me a long time to accept this, and I have battled against it for years… but crowds really like LIMO’s.

Whats a LIMO?

In street performer circles – this is a “Large Impressive Metal Object”. my LIMO of choice is the giraffe Unicycle.

Street performing with my LIMO (A Giraffe Unicycle)
Street performing with my LIMO (A Giraffe Unicycle)

The LIMO can change a mediocre show into an OK show, a good show into a great show – and a great show into a spectacular show! But it’s greatest strength, is also it’s greatest weakness. Many performers won’t take the time to develop original show material as the LIMO “does” a lot of the work for you. Im as guilty as the next guy, and for a long time kinda despised using the Unicycle in my show.

Other performers might use a free standing ladder, or a table, or even a static pole. But my favourite is the Tall Unicycle. Its a prop many of us can kind of relate to, as we’ve all (well almost all) learnt how to ride a two wheel bike. Audience members are always fascinated with the unicycle, and even more so the tall unicycle. My current ride is around 2 meters in height with a custom built smaller 16″ wheel. I had the custom wheel made as it packs better in my suitcase. It has the bonus effect of making the Uni look just that little but taller.

Many performers discredit other performers who use a LIMO, as the LIMO instantly gives the performer credibility in the eyes of the public. While this is what all performers desire, some see it as being uncreative, generic or just downright lazy. And I’ll be honest, I suffer from this too, and will instantly write-off anyone I see using one as a generic hack… myself included.

Street performing with no LIMO

Since the birth of my daughter 2 years ago, and me focusing more on my company – I decided I would work without the LIMO. The first thing I noticed was I made less money in my hat. Though only on shows which didn’t go as planned. I did find that a good show is a good show with or without the LIMO, and that was comforting. But, I also found that those good shows were harder to get! Especially when performing outside of festivals. Festival Street Shows and Street Shows are entirely different animals – what may work well at a festival will not necessarily translate to a working Street Show. Not all Street pitches are created equal either. Maybe write about that some other time.

So anyway, I performed two summer seasons in Europe, and one summer season in Australia LIMO-free and loved every minute of it. For starters I wasn’t dragging around an extra 15kg in my suitcase. I also didn’t have to worry about dismantling and reassembling it every time I travelled to a new Gig.
Nice!
Happy shows!

…and back to the LIMO!

However, once I arrived back home to Australia this past September, I felt like dragging the Uni back out. I wasn’t sure how it would go, as I hadn’t done a show on the Unicycle for almost 2 years (I still ride my small uni from time to time) but the show actually went pretty well. It was a little rusty obviously, and i’d forgotten most of the gags – but I really enjoyed the show. Now I find myself looking forward to the next show, and super stoked to head out and do a show with my Uni.

I feel I’ve finally come to appreciate what the LIMO adds to the street performing, without feeling like I’m letting myself down for using it. My son prefers my Unicycle show too.
Double winning
πŸ™‚

Street performing with my tall Uni
Street performing with my tall Uni

goodbye Google – I value my privacy too much

So I’ve been using DuckDuckGo as my default search engine on macOS and iOS now for at least 2 years. I am also at the point, where I find myself having to use Google as a backup search less and less. Chrome was never interesting to me. And I stopped using calendar years ago. I do however still have a personal gmail account which I use sporadically. But mainly only so I don’t get spam in my more important accounts. I tried to setup an Adsense account for Cookie around a year ago. But it kept being cancelled because it was against policies…. Analytics was also removed from all my sites a couple of years ago!

Google Adwords

And just today I also (finally) removed the last of the Adwords that I (had totally forgotten about) was using on some product pages for the long retired apps SafariCookies and SafariAdBlocker. It makes no sense for me (and is even hypocritical) to be supporting a company which goes out of it’s way to invade users privacy so blatantly.

goodbye Google
goodbye Google

So sayonara Google, tschüß and goodbye.