Follow instructions in the link given below to install Postfix and configure gmail smtp as relay in it.
In the step where you are adding Gmail Username and Password to Postfix. Use the password generated for your app as password.
I hope your setup goes well. Thanks for reading this post.