Mail was worn by soldiers other than knights. Not only was mail not reserved only for knights, in some places at some times, other soldiers and potential soldiers were legally required to own mail. For example, in the Assize of Arms of 1181 proclaimed by Henry II (of England),
every free layman who possesses chattels or rents to the value of 16 marks shall have a shirt of mail, a helmet, a shield, and a lance; and every free layman possessing chattels or rents to the value of 10 marks shall have a hauberk [i.e., a mail shirt], an iron cap, and a lance.
This legal requirement for those who meet the property/income qualifications to own mail armour was repeated in the Assize of Arms of 1252, proclaimed by Henry III:
x. libratas terre, unum haubergellum, capellum ferreum, gladium et cultellum; ... ad catalla xl a marcarum. unum haubergellum, capellum, gladium et cultellum
(those with 10 (pounds?) worth of land or 40 marks worth of goods must have a hauberk (mail shirt), an iron cap, a sword and a knife) and the Statute of Winchester of Edward I (1285):
for ten pounds of lands, and twenty marks goods, an hauberke, an helm of iron, a lance, and a knife
Those is the property/income bracket above this were also required to own mail armour, and in addition a horse (thus, they were to be equipped as knights, whether or not they were knights). The amount of land required to be in this higher bracket was also known as a "knight's fee" ("fee" = "fief"), and might be given to a knight for his support. Those in the bracket below this (i.e., those to whom the laws quoted above applied) were not required to own a horse, and would have fought as armoured infantry. Those in the property/income bracket immediately below these were not required to own mail, but had to own textile armour (gambeson) and a helmet, and weapons. Those in even lower property/income brackets had to own weapons, but not armour.
Apart from the armoured infantry, as noted above not all of the armoured cavalry were knights. For example, in Edward III's army at the Battle of Crécy, only a minority of his men-at-arms (i.e., armoured cavalry) were knights (Hefferan, 2019).
Finally, art shows non-knights (such as crossbowmen and archers) wearing mail (and other armour):
https://commons.wikimedia.org/wiki/File:Battle_of_crecy_froissart.jpg
https://commons.wikimedia.org/wiki/File:Battle_of_Auray_2.jpg
References:
Assize of Arms of 1181: https://en.wikipedia.org/wiki/Assize_of_Arms_of_1181
Assize of Arms of 1252: Close rolls of the reign of Henry III, Vol. 4, pp. 482-3 https://archive.org/details/closerollsofreig04grea
Statute of Winchester: https://en.wikisource.org/wiki/Statute_of_Winchester
Matthew Hefferan, 2019, "Edward III’s household knights and the Crécy campaign of 1346", Historical Research 92(255), 24-49. https://doi.org/10.1111/1468-2281.12250