Despite the growing importance of digital learning environments and motivational factors in language acquisition, there is a paucity of research exploring how these elements interact to influence student engagement, particularly in the context of Iranian EFL learners. Addressing this gap, the aim of this study was to examine the relationship between informal digital learning of English (IDLE), ideal L2 self, foreign language enjoyment (FLE), and student engagement among EFL learners using a structural model. The researchers conducted a mediation analysis to investigate whether FLE would mediate the effects of IDLE and ideal L2 self on student engagement. Data was collected from 378 Iranian EFL learners who completed four questionnaires related to the variables of interest. Structural equation modeling (SEM) was used to test the hypothesized relationships. Confirmatory factor analysis (CFA) was conducted to assess the fitness of the questionnaires and the structural model. Results indicated that ideal L2 self and FLE had a direct impact on student engagement, whereas IDLE influenced student engagement indirectly through FLE as a mediator. The findings suggest important implications for theory and practice, highlighting the significance of fostering a positive ideal L2 self and leveraging informal digital learning environments to enhance student engagement in EFL contexts.