Handle mongo and mail URL variables better