Paul Demetry appeals the district court’s order dismissing his class action complaint against Lasko Products, Inc. (“Lasko”), pursuant to Fed.R.Civ.P. 12(c). Demetry alleged that Lasko engaged in unfair and deceptive acts and practices, in violation of the Maryland Consumer Protection Act (“MCPA”), Md.Code Ann., Com. Law § 13-301 (Michie 2005 & Supp. *152007), and was unjustly enriched by selling fans with a known design defect that has caused fires due to an electrical failure in the fans’ motors.
Lasko manufactured the defective fans from 1999 to 2001 and sold them until February 2004. In February 2006, following numerous reports of fires caused by motor failures in the fans, Lasko issued a voluntary recall notice in cooperation with the United States Consumer Protection Commission (“CPSC”). Demetry attached CPSC’s announcement of the voluntary recall as an exhibit to his complaint. The recall notice advised consumers to immediately stop using the identified Lasko fan models and contact Lasko to receive a free power cord adaptor that would protect against fires. Demetry alleged that he purchased and installed Lasko fans with the known design defect as part of his business, he would not have purchased them if he had been aware of the defect, he did not receive adequate notice of the recall, and that the cord adaptor was not an adequate remedy for the defective fans. Demetry did not allege that he availed himself of the free cord adaptors offered by the recall or that any of the fans he purchased caught on fire or otherwise malfunctioned as a result of the design defect.
The district court granted Lasko’s motion to dismiss as to all of Demetry’s claims because he did not sufficiently allege what damages he suffered. Demetry noted a timely appeal.
Demetry initially argues that the district court erred in considering facts outside the scope of his complaint when it ruled on Lasko’s motion for judgment on the pleadings without converting the motion to a motion for summary judgment. Specifically, Demetry contends that the district court improperly considered the voluntary recall of the defective fans that Lasko negotiated with CPSC because the fact of the recall constitutes an affirmative defense and the facts necessary to the defense were not clearly established on the face of Demetry’s complaint.
We review a dismissal under Rule 12(c) de novo, applying the standard used to assess a Rule 12(b)(6) dismissal. Burbach Broadcasting Co. v. Elkins Radio Corp., 278 F.3d 401, 405-06 (4th Cir.2002). To survive a Rule 12(b)(6) motion, a complaint’s “[fjactual allegations must be enough to raise a right to relief above the speculative level” and have “enough facts to state a claim to relief that is plausible on its face.” Bell Atl. Corp. v. Twombly, -U.S.-, 127 S.Ct. 1955, 1965, 1974, 167 L.Ed.2d 929 (2007). Generally, when ruling on a Rule 12(b)(6) motion, “a judge must accept as trae all of the factual allegations contained in the complaint.” Erickson v. Pardus, 551 U.S.-, 127 S.Ct. 2197, 2200, 167 L.Ed.2d 1081 (2007) (citations omitted). However, the court is not required “to accept as true allegations that are merely conclusory, unwarranted deductions of fact, or unreasonable inferences” or “allegations that contradict matters properly subject to judicial notice or by exhibit.” Veney v. Wyche, 293 F.3d 726, 730 (4th Cir.2002) (citation and internal quotes omitted).
A district court may reach the merits of an affirmative defense when ruling on a motion to dismiss “if all facts necessary to the affirmative defense clearly appear on the face of the complaint.” Goodman v. Praxair, Inc., 494 F.3d 458, 464 (4th Cir. 2007). “A copy of a written instrument that is an exhibit to a pleading is a part of the pleading for all purposes.” Fed. R.Civ.P. 10(c). Therefore, the district court properly considered Lasko’s voluntary recall notice attached to Demetry’s complaint in ruling on Lasko’s Rule 12(c) motion. The recall notice was part of Demetry’s complaint for all purposes, and established that Lasko voluntarily offered to provide consumers with power cord *16adaptors to prevent the defective fans from causing fires, a fact necessary to establish Lasko’s affirmative defense.
Demetry also challenges the district court’s dismissal of his claims under the MCPA, and for unjust enrichment and common law fraud. We have reviewed the record included on appeal, as well as the parties’ briefs, and find no error in the district court’s ruling. Accordingly, we affirm. We dispense with oral argument because the facts and legal contentions are adequately presented in the materials before the court and argument would not aid the decisional process.
AFFIRMED.