I would recommend installing drainage away from the house. Instead of sticking the end of the downspout into the drain line, which makes for extremely difficult maintenance (removal of downspout for cleaning ) Install a debris filter or receptacle box for the downspout to drain into. This will provide a leaf catcher to prevent clogging of the drain and facilitate removal of the downspouts when necessary.

debris filter: