You only get miles if your boarding pass is scanned or entered at the gate as the last step of the boarding process. At that point, if you somehow managed to avoid boarding without it being noticed by the gate agent, it would most likely be caught when they did the passenger count before departure.