“When” should be used if you are referring to a specific time.
“Whenever” should be used if the time is less specific or repetitive.
“When ever” should only be written as two words if the meaning is “when, if ever”.
Example: When ever will you answer your email?