Defending your captured portals is nearly as important as capturing them in the first place. Resonators can be destroyed two ways, both are preventable. The first is just neglect, as resonators decay about 10% of their charge every day. The second, is via an enemy using an xmp burster within range of your resonators.
The only defense against resonator decay, is to recharge your resonators. I have some good news for you, you do not need to physically be at a resonator in order to recharge it, if you are not within range of the resonator, you merely need to have one of it's Portal Key's. To test this out for yourself, click "OPS" from your Ingress Scanner and filter by "Portal Key" and select a portal that is a significant distance from you. You will be view the portals current status and if you have enough energy, recharge the portal from your current location. At this time, I do not know if there is a maximum range (possibly the portals linking range?), but there is an efficiency indicator implying that the further away you are, you will recharge the portals less of a % per attempt.
You have two options to defend your portal from an enemy attack. The first is proactive by placing Portal Shields on the portal which act as a first defense for your resonators. You can place up to 4 shields on a portal. Each shield beyond the first shield has diminished effect. The second defense is recharging your resonators during an attack. As mentioned above, portal resonators can be recharged remotely as long as you have the portal key. So, it is in your best interest to make sure that you have a portal key for your portals and have ample XM reserves at all times. This way when you receive an alert that your portals are under attack, you can potentially keep the portal up long enough for the attacker to run out of xmp's or their smoke break to end.
Keep in mind, the destination portal key is consumed during every portal linking action. So in hostile territories, you will need to retrieve portal keys often or coordinate with other players to help defend portals you don't have keys for.