Plasma-environment effects on K lines of astrophysical interest