For mail express trains, unreserved ticket are issued in three days advance. That means you can buy an unreserved ticket today even if your journey is after three days. For passenger trains, unreserved ticket are issued one hour before the departure of the train. And its not possible to purchase unreserved ticket online, you have to visit station counter for it.