If your application is deployed in Heroku, Heroku server doesn’t provide email server by default. In my previous post Deploying application on Heroku, I showed how to deploy a Spring Boot application in Heroku. Over to that, most applications use their custom domain and you will need email addresses with those domains for support or sales perspective.
So how do you set up custom email with your application domain? In this case, I needed to set up an email address info AT rentersvoices.com so people could contact me.
It’s a straightforward process and I will show in this post how to set up custom email.
Set up Custom Email in Heroku Application
Remember Heroku offers an option of CloudMailIn for custom email. It helps to receive incoming emails. In this post, we will not be using CloudMailIn with the restriction it has for free option in Heroku.
Instead, we are using forwardemail.net. There are few other options available like MailGun or SendGrid
To set up a custom email, you will need to add CNAME or MX records for your domain with your domain provider.
In my case, I was using NameCheap as my domain provider.
Add following MX records for your domain:
Type Host Value Priority TTL
MX Record @ mx1.forwardemail.net 10 60 min
MX Record @ mx2.forwardemail.net 20 60 min
Once we have configured MX records, we will need to configure TX records. This step is required so we can forward email coming to our custom domain to an email address of our choice.
Type Host Value TTL
TXT Record @ forward-email=abc@yahoo.com 60 min
TXT Record @ v=spf1 mx include:spf.forwardemail.net -all 60 min
After we add these records, we should wait till the cache is cleared for the domain. You might have to wait for an hour at max. Now try sending an email to custom address (in this case info AT rentersvoices.com) and you will receive that email at abc AT yahoo.com.
Conclusion
In this post, we showed how to set up an email in Heroku application. If you have any feedback, please feel free to post your comments below.
Yes, yes, Rentersfeedback.com is Rentersvoices.com. Previously I described how I came up with an idea to create an application here. I am rebranding RentersFeedback to RentersVoices. I was actually looking for that domain for some time now, finally, when I was able to get the domain, I immediately made the shift.
Why Rebranding?
You can argue that rebranding RentersFeedback to RentersVoices seems unnecessary, but I always had a hint that I needed this domain. Even when I was launching Rentersfeedback.com, I was looking for the domain rentersvoices.com and I never got it. It was taken.
Renters Voices is a better name. Renters Feedback sounds very forced name.
Now I can implement a few more ideas that I have in mind based on rentersvoices name.
I also received good feedback from Indiehackers.com here.
Domain names are not easily available. Sometimes, it takes a lot of time to constantly look for a domain that you want. When I started building an application, I looked for rentervoices.com, but it wasn’t available. Now when I got the right domain, it was no no-brainer to rebrand my application to rentersvoices.com.
Marketing
At Indie Hackers meetup, I got a few marketing ideas from experienced indie hackers. Especially I really liked the idea to use flyers and talk to people at university campuses and ask them to post reviews.
I hope the rebranding will help me take that risk with marketing and get more leverage to push forward.
A few other ways to market the application are
To join some of the Facebook groups where they post about rental properties. Ask the people to submit reviews
Reddit communities can be equally helpful to get some feedback.
Talk to renters and people. Talking to people is the oldest form of marketing.
So sign up at rentersvoices.com and post a review about your rental apartment or house.
RentersFeedback is a brainchild from a tweet that a friend tweeted back in August:
Based on this tweet, I thought it would be nice if renters have some say about landlords. Around the same time, my girlfriend was looking for an apartment/house to rent. Even though we found a place, we were not sure if it’s a good place. And there were no reviews about this place. On the first impression, the house didn’t look like a place where anybody has lived in a long time, but we made our decision and went ahead with it. It would have been nice if there was a review of this place.
I am sure when most people are looking for places to rent, they use services like Padmapper or Zillow which offers the easiest way to find places based on area, requirements, budget, other facilities. But none of these applications offer a review system.
What this will solve?
Renters Feedback will solve the much-needed place to provide reviews about the places that people are renting. This will help future renters to look for good places to rent. This will also make landlords and rental management companies more accountable. I hope Renters Feedback can help renters with reviews for the places they want to rent.
What about Yelp?
Yelp.com has been providing reviews of restaurants, small businesses, and other things, but rarely of a standalone house to be rented or a rental management company. Yelp has done a tremendous job, but it lacks in this one area.
Why an application with a single functionality?
Less is more. Simple functionality matters in long terms than a complicated one. In marketing, there is a term affordance that refers to the perceived and actual properties of the thing, primarily those fundamental properties that determine how the thing could be used. A single functionality of the application will help users to navigate and use the application efficiently.
Techstack
To build RentersFeedback.com, I have used Spring Boot Microservice based architecture. I have implemented the current user interface using Twitter Bootstrap, CSS, Javascript, Google Javascript API, and Thymeleaf. Backend is written using Java and database supported.
Using Redis for caching, Google for OAuth2 authentication along with regular authentication.
Heroku.comis my choice of the cloud platform to launch the application. It offers an easy way to assemble all the needed services like database, Redis, and the server itself.
One future change for this might be to move the user interface to reactjs. Something that is currently I am working on.
Feedback
I would love it if you could use the application and would appreciate any feedback. Subscribe to my blog to find out more about renters’ feedback.
Heroku is a platform as a service (PAAS) that helps developers to build, deploy, and run applications on a cloud platform. Deploying Spring Boot application to Heroku is a straight forward process. I will describe this process in this post. There are actually multiple ways to deploy a spring boot application. The simplest way to deploy the application is to use maven built jar file and run that jar file on Heroku server.
In my previous post, I showed how to use Spring session in your Spring Boot application.
Before I show one of these two methods to deploy the application, we assume that you have created an account on Heroku.com, if not first please create an account and download Heroku-CLI (Command Line Interface). I also assume that you have git downloaded and installed.
Initial Deployment with Heroku
Once you have Heroku account and Command Line Interface downloaded, let’s start deploying the Spring Boot app with repository.
Create an application directory on your development environment.
git init
git add .
git commit -m "first commit"
Now you can either create an app in Heroku through web-interface OR through Heroku CLI.
heroku create rentersfeedback would create the application in Heroku.
As part of this post, I am deploying an alpha version of my application rentersfeedback.com
Once you add the source code to the directory, we can push the repository to heroku. Every time you push the repository to Heroku, Heroku’s builder will build the application and launch it.
git push heroku master
Despite this initial push, we don’t have the application ready to use yet.
Database Configuration
For this application, I will be using Postgres database. Heroku offers a couple of ways to add database as an add-on.
Once Postgres database is added, go to settings -> view credentials this will provide us database credentials.
Now we can access the database server through pgAdmin Postgres Administration and create database and database tables for our application.
Back in Heroku web-interface, if you go to the application settings page, click on reveal Config Vars and set up the following variables
As you can see that we are using datasource type as tomcat jdbc pool and not the standard hikariCP which Spring boot provides. To make sure to work this, we have to add a dependency of tomcat-jdbc as follows:
If you don’t specify data source type as tomcat-jdbc, Heroku throws an error for Postgres database as below:
Causedby: java.lang.RuntimeException:Driver org.postgresql.Driver claims to not accept jdbcUrl
This will get our Spring Boot app to work with the Postgres database while deploying on Heroku.
Configuration of Gradle to build a jar file
So by default, Heroku supports maven. If you want to use Gradle to build your application, you can use the following guidelines.
Now if you push these changes to heroku and build the application, the application will throw the following error while starting up
2019-11-30T17:05:46.096985+00:00 heroku[api]: Deploy 291326d by xxx@gmail.com
2019-11-30T17:05:46.097021+00:00 heroku[api]: Release v9 created by xxx@gmail.com
2019-11-30T17:05:46.378258+00:00 heroku[slug-compiler]: Slug compilation started
2019-11-30T17:05:46.378269+00:00 heroku[slug-compiler]: Slug compilation finished
2019-11-30T17:05:46.755655+00:00 heroku[web.1]: State changed from crashed to starting
2019-11-30T17:05:53.121398+00:00 heroku[web.1]: Starting process with command `java -Dserver.port=5000 -jar build/libs/myapp.jar`
2019-11-30T17:05:54.260741+00:00 app[web.1]: Error: Unable to access jarfile build/libs/myapp.jar
2019-11-30T17:05:54.784064+00:00 heroku[web.1]: State changed from starting to crashed
2019-11-30T17:05:54.773714+00:00 heroku[web.1]: Process exited with status 1
To resolve this issue, I will add a task in my gradle script that will build a jar file when I deploy the application.
We have deployed our application, configured database, and build script. Usually when spring boot application starts, it will access all the required variables from application.properties. So I will set up that file as follows:
Heroku offers an easy option with SSL, so if you choose that, it is a straightforward approach with Let’s Encrypt to automatically manage the SSL certificate.
Now to set up the custom domain, add your domain and heroku will provide the target DNS server. For your corresponding domain provider, you will add DNS setting for CNAME(for www) and ANAME (root domain). Wait for a few hours for this setting to take place.
Access the application
We are ready to access the application now. Once you have pushed all the required changes to Heroku repository, heroku will build the application and launch it.
Now if we access rentersfeedback.com, we will be able to see the application as follows: