When Alan* heard the email “ping” from his new boss’s nearby desk, his quiet laughter turned to a sinking feeling in his stomach. Was that a notification that she’d received the email he’d just sent, mocking how she’d criticized the mess left in the office kitchen? He swore he had hit “forward” before writing his scathing response… but it turned out he hit “reply” instead. And what he wrote, intended as a private joke between buddies, was not going to do him any favors with the boss.

Seeing that his boss was not at her desk, he hovered in panic over her keyboard to see if he could get into her computer and delete it. But the machine was locked. In desperation, he sprinted down two flights of stairs to the IT department — passing his boss, who was on her way up the stairs. He somehow managed to convince a sympathetic IT staffer to go into her email box and delete the offending missive. “Having made this horrible mistake,’’ Alan says now, “The best advice I can give someone else, is always make friends with the IT guys!” To this day, however, he’s not sure if she saw the email before it was deleted. Which was, in some ways, the worst possible outcome, because he lived in fear of reprisal, but didn’t have the courage to come clean in case she hadn’tseen it.

For most of us, undoing such a faux pas is not possible – as Sony and many members of the Hollywood elite have been painfully finding out with the seemingly unending exposure of embarrassing emails throughout December. (This wasn’t the worst part of the hack for Sony, but presumably it was a very big deal for the individuals involved.) And it’s a problem that many of us have faced, whether it’s accidentally hitting “reply” instead of “forward,” forwarding an email without thinking about what’s been written below, or toggling clumsily between including and excluding someone in a group email. A much-loved former boss accidentally revealed my pregnancy before I was planning to share the news, after he unwittingly forwarded an email exchange we’d had that had started with my telling him I’d be out of the office for a doctor’s appointment. Mark Zuckerberg’s early instant messages were revealed in 2010, in which he mocked early Facebook users for trusting him with their data.  Each of the experts I consulted for this article offered one of their own mistakes as an illustration.  ”No matter how many times we’re reminded that electronic communications stick around long after we’ve sent them and that they’re often not as secure as we think, many of us are still remarkable indiscreet in what we communicate via email, text, chat, and social media,’’ says Monique Valcour, a professor of management at EDHEC Business School in France.

So, having made the mistake, what now? There’s only one option. Own it. Approach the offended colleague quickly and directly, advises Jeanne Brett, Director of the Dispute Resolution Research Center at Kellogg School of Management. How do you word an apology when you’ve been a jerk? “I’m sorry I did it and even more sorry that I hurt/embarrassed/humiliated/showed disrespect for you,’’ Brett suggests. “I spoke/wrote without thinking and if I could take it back I would. I can only ask you to forgive me.’’

The last sentence, she points out, is particularly important because it turns the situation back on the other person and seeks forgiveness.  This assumes, of course, that your communication was merely offensive and inappropriate, as opposed to libelous or a violation of company policies. Legal experts often caution people not to apologize when there is risk of litigation, but even then, recent research indicates the potential power of a sincere mea culpa. For instance, research suggests that physicians have a significant opportunity to deflect medical malpractice suits if they offer sincere apologies, taking responsibility for their mistakes.

In any apology scenario, advises Valcour, avoid insincere language of the “mistakes were made’’ or “I’m sorry if somehow you were offended…’’ variety. Make the apology in person or by phone, especially considering that email leaves tone to the imagination of the reader. You don’t want to risk getting it wrong again.

“There’s a saying in politics that you only have three options about what to say when it comes to crisis communications,’’ advises Dorie Clark, who earned her stripes as a communication director for the Howard Dean presidential campaign. “One, you didn’t do it; two, you did it but you were justified; and three, you did it and you’re sorry.’’ For most leaked or forwarded emails, options one and two are out the window, Clark says. For instance, “It would look pretty foolish for Amy Pascal to defend her badinage about which black movie stars President Obama might like best.’’

As awful as you’ll feel having to make an apology, recognize that you may well have done real damage and an apology may not be enough. “You may need to take additional steps to show that you actually care about the issues at hand and are taking it seriously,’’ Clark advises. (For example, if Pascal manages to retain her job at Sony, she’ll probably need to make diversity a focus on subsequent hires.)

“And it goes without saying, you can’t be an idiot in the same way twice,’’ Clark says. If you’re lucky enough to get a reprieve, don’t make the same mistake again.

*Not his real name.

Karen Dillon is the former editor of Harvard Business Review and co-author with Clayton Christensen and James Allworth of New York Times best-seller How Will You Measure Your Life.  She’s also the author of the HBR Guide to Office Politics. Follow her on Twitter at @DillonHBR.