To begin a letter of apology, describe the mistake you or your company made, and accept responsibility. An example is "Please accept our apologies for the shipment error. We have discovered a flaw in our new order-taking software that escaped our initial quality checks."
Also identify any inconveniences caused to the customer. An example is "We realize that this error delayed your production schedule." Additionally, explain what you are doing to solve the problem: "To continue providing high-quality service, we have consulted a programmer." End the letter positively to ensure a continuing relationship: "If we can further assist you, please contact us. We look forward to our continuing business relationship."