A man who made death threats to two mosques in the wake of the Manchester synagogue attack has been jailed for more than two years, prosecutors have said.