Is it dangerous to have sexual intercourse with a heart problem?

I get palpitations after sex and my partner’s sex drive is also low. Do you have any suggestions?