PHP mail not delivering domain emails to external mail server

PHP mail not sending domain emails to external mail server

Recently, I’ve done some work for a client with an odd issue: the contact forms on their website (let’s call it client-website.com) — which delivered completed form enquiries using PHP’s mail() function — could not send emails through to email addresses containing their own domain.

This means that, if we were to set the form to deliver enquiries to an address like hello@client-website.com, the email would be completely dropped — you would neither find it in the junk or spam folders, nor find any trace of the email in their admin and mail logs. If we delivered the email to our own personal email addresses (e.g. personal@gmail.com), or to emails from another domain (e.g. mail@terresquall.com), then the email would go through (and skip right past the spam folder too).

For weeks, this problem confounded me, until now… and it’s actually a really simple fix.

Continue reading
Adding dates to custom post permalinks in WordPress

Making date-based permalinks for custom posts in WordPress

If you didn’t know already, this blog is not the only thing that we work on — we also take on clients to work on website and web-related projects for them. Recently, we worked on a website project where we had to code a custom WordPress post type into the custom theme we made for the client (yes we make those).

This custom post type (which shall henceforth be called Articles — what we named the post type) was supposed to serve a purpose similar to the default WordPress Post — it was meant to go into a blog section for the website, and the client wanted to be able to assign categories to individual articles. All of this is pretty standard fare when it comes to WordPress customisation, as you can easily figure out how to do it reading official guides and documentation from WordPress:

We needed something a bit more though, as we wanted to customise the permalinks (i.e. auto-generated URL) of our Articles such that they are:

  1. Preceeded by the article slug, e.g. example.com/article/my-article-title
  2. Display the year and month before the post title, e.g. example.com/article/2021/03/my-article-title
  3. Display a list of articles posted on the specified year and month if it was specified in the URL, e.g. example.com/article/2021/03 would show all the articles posted in March 2021.

Want to find out how we did it? Then continue reading.

Continue reading
Setting up Infusionsoft's PHP SDK

Using Keap’s (aka Infusionsoft) PHP SDK (2021)

If you are creating applications that work with Keap CRM — formerly known as Infusionsoft — you might be unsure where to start. After all, many of the guides available online for working with Infusionsoft’s API are outdated. Additionally, although the official documentation is an option, it’s a little too vague, especially if you are new to the whole web API business.

I recently worked on a project where I had to integrate a set of fields in a web form with Keap’s CRM system — that is, users will fill up a web form, and the information will automatically be sent to Keap’s CRM database for storage. After a lot of trial and error, as well as source code reading, I’ve managed to get my form working.

I’ve put together this guide in the hopes that you can have a smoother journey of integrating Keap’s / Infusionsoft’s CRM into your web services.

In Keap’s / Infusionsoft’s defense, their documentation is much better in their GitHub repository, as they have more concrete instructions and examples. Once the API is set up on your web application, the information in the repository is actually very helpful.

Continue reading
Adding virtual hosts on Bitnami Apache

Adding virtual hosts on Bitnami Apache

Over the weekend, I’ve spent a substantial chunk of time figuring out how to add a virtual host onto a client’s subdomain. In laymen’s terms, this means that:

  1. My client has a website hosted on a domain (which we shall call example.com, for confidentiality reasons)
  2. We want to build a web application on app.example.com, which will be entirely separate from example.com.
  3. To save on cost, we want to host app.example.com on the same server that example.com is using (i.e. create a virtual host on the web server).

This means that we have to configure our web server so that it will serve a different webroot depending on the domain it is being accessed from.

Continue reading

Content begins after the advertisement:


Shallow vs. deep copying in Python

Shallow vs. deep copying in Python

If you’ve worked with Lists in Python before, you’ll quickly realise that they work differently from primitives like integers and strings. Consider the following:

a = "hello"
b = a
a = "world"
print(a) # Outputs world
print(b) # Outputs hello

Notice that changing the value of a does not change the value of b. This is called passing by value. In Python, Lists do not behave this way:

a = [2, 3, 4, 5]
b = a
a.append(6)
print(a) # Outputs [2, 3, 4, 5, 6]
print(b) # Outputs [2, 3, 4, 5, 6]

In the above example, notice that changing the value of List a also changes the value of List b. This is because both a and b are referring to the same List, and this is called passing by reference.

Continue reading
Apoca Force - Gameplay

Drawing radar charts for stat UIs in Unity

As part of a school assignment in the past year, my team and I created Apoca Force, a tower defense game where WAIFUs (World Apocalypse Intercepting Frontline Units) are deployed onto a battlefield to combat an undead horde. To provide some variation (and eye candy) in gameplay, the game provides a variety of different WAIFUs for players to deploy.

To display the different stats WAIFUs have, we decided to include a radar graph on our build interface to illustrate the stats of each type of WAIFU. In this article, I will talk about the technicalities involved in making that happen.

I have previously written an article about how we rendered Unity’s NavMesh to show our WAIFUs’ walkable areas. Check it out!

Continue reading
Security for your Ubuntu Droplet

Setting up basic security for your Ubuntu Droplet

Have you recently spun up a new Ubuntu Droplet on DigitalOcean? The other day, when I checked my authentication logs in /var/log/auth.log, I came across several login attempts with random usernames.

Malicious login attempts in Ubuntu
Login attempts by malicious users.

We often take security for granted, but it becomes something of great concern once you start to manage servers of your own. If you were to leave your Droplet as it is, it is only a matter of time before hackers guess your login credentials and gain access to your system. Hence, here are some basic security measures you should set up to prevent others from breaking in:

Continue reading
Unity 2019 Splash Image

The definitive guide to installing Unity in 2024

Unity has seen growth in leaps and bounds since its humble beginnings in 2005, having IPO-ed for a whooping US$1.3 billion in September 2020. It is also looking at releasing Unity 6 — chock with a whole bunch of new features — at the end of 2024.

Since its tremendous growth over the past 3 decades, the Unity Engine has also changed significantly over the past decade, so much so that it has become difficult to set up and use, especially for new users. If you’re just getting your toes wet with the engine for the first time, here is a guide to help you figure out how to set it up — the trouble will be worth it, because it is one of the easiest game engines to use, and also one of the most robust game engines out there.

Continue reading

Content begins after the advertisement:


Fixing Visual Studio's IntelliSense in Unity

Fixing Visual Studio’s IntelliSense (auto-complete) in Unity

If you like our article, do take some time to check out the rest of our site! We have plenty of Unity-related posts, tutorials and even some content on web development!

One of the biggest perks of using Microsoft’s Visual Studio to write your Unity scripts is IntelliSense — a code completion aid in Visual Studio that offers suggestions as you write your code, and contextually presents you with information about classes, properties and methods that you are working with.

Given Unity’s enormous scripting API, IntelliSense is a tremendously helpful feature, especially for coders who are beginning their foray into developing games and software with Unity; and while we’d love to say that IntelliSense is automatically set up and linked to Unity’s API when you install it with the Unity Editor, sometimes that’s just not the case. So, if you’ve got both Unity and Visual Studio set up, but find that IntelliSense is still not offering Unity API suggestions, then this guide is for you.

Visual Studio's IntelliSense for Unity
If IntelliSense doesn’t automatically offer Unity API suggestions like these, then it isn’t working.
Continue reading
PayPal Conversion
Original photo by Lukas from Pexels: https://www.pexels.com/photo/analytics-blur-business-close-up-590045/

Save money by being smart with PayPal conversion

In today’s digital era, where everything is becoming smarter and faster, and everyone is about doing things that make them look smart, PayPal is absolutely invaluable. It’s a payment platform that stores all of our payment information across different cards and banks, so we don’t have to remember and re-enter pesky things like credit card numbers everytime we purchase something. Just click on PayPal’s big yellow checkout button! It’s the smart thing to do, right?

Continue reading