since the train stops in Domodossola you only need a ticket Domodossola - Milan. until Domodossola it is tariffically counted as switzerland. probably you can save money by changing in Domodossola into a regional train.
You can buy in most Swiss stations the ticket Domo-MIlano, at full fare high Swiss prices, IF you plan to ride through, then there is ALSO a RES needed-extra 11€. IF you want to save that lot you have to buy with € the ticket for regionale in Domo -machine or counter.
IF you then plan to travel a few days in that area of IT only-there is a cheap 3-day LOviaggio, valid in all of Lombardia (also bustram) but I am not sure here if this covers Domo.
IF you fancy a nice ride with views and have time: use the Centovalli local line east from domo till LOCarno, then change (this is all counted as IN swiss, so your pass is valid)-then go to Lugano-C hiasso-and from Ch regionale (ev 30 mins, in 50 mins) to Milano-and LO-V certainly valid there