BackgroundA healthy diet is an important component of secondary prevention of coronary heart disease (CHD). The TEXT ME study was a randomised clinical trial of people with CHD that were randomised into standard care or a text-message programme in addition to standard care. This analysis aimed to: 1) assess the effects of the intervention onadherence to the dietary guideline recommendations; 2) assess the consistency of effect across sub-groups; and 3) assess whether adherence to the dietary guideline recommendations mediated the improvements in objective clinical outcomes.MethodsDietary data were collected using a self-report questionnaire to evaluate adherence to eight dietary guideline recommendations in Australia, including consumption of vegetables, fruits, fish, type of fat used for cooking and in spreads, takeaway food, salt and standard alcohol drinks. The primary outcome of this analysis was the proportion of patients adhering to ≥ 4 dietary guideline recommendations concomitantly and each recommendation was assessed individually as secondary outcomes. Data were analysed using log-binomial regression for categorical variables and analysis of covariance for continuous variables.ResultsAmong 710 patients, 54% were adhering to ≥ 4 dietary guideline recommendations (intervention 53% vs control 56%, p = 0.376) at baseline. At six months, the intervention group had a significantly higher proportion of patients adhering to ≥ 4 recommendations (314, 93%) compared to the control group (264, 75%, RR 1.23, 95% CI 1.15–1.31, p < 0.001). In addition, the intervention patients reported consuming higher amounts of vegetables, fruits, and fish per week; less takeaway foods per week; and greater salt intake control. The intervention had a similar effect in all sub-groups tested. There were significant mediational effects of the increase in adherence to the recommendations for the association between the intervention and LDL-cholesterol (p < 0.001) and body mass index (BMI) at six months follow-up (p = 0.005).ConclusionA lifestyle-focused text-message programme improved adherence to the dietary guideline recommendations, and specifically improved self-reported consumption of vegetables, fruits, fish, takeaway foods and salt intake. Importantly, these improvements partially mediated improvements in LDL-cholesterol and BMI. This simple and scalable text-messaging intervention could be used as a strategy to improve diet in people with CHD.Trial registrationAustralia and New Zealand Clinical Trials Registry ACTRN12611000161921. Registered on 10 February 2011.Electronic supplementary materialThe online version of this article (10.1186/s12966-018-0677-1) contains supplementary material, which is available to authorized users.