Why is "连忙" wrong in the following sentence? My question is as the title. The sentence is: 如果她来了，请你连忙告诉我。

The correct sentence is "如果她来了，请你马上告诉我". Why?
连忙 and 赶忙 cannot be used in the imperative, although 立刻, 马上 (and also 赶快 and 赶紧) can.

Technically, 连忙, 赶忙 denote something that happens fast (now), while 立刻, 马上 denote something that is about to happen (soon).

See 连忙 as present tense, and 马上 as the future tense, if you will. Imperatives then belong to future actions.