If you do not already have Android Debug Bridge (ADB) installed, you can get the platform tools at android.com. How to check if you already have ADB?
adb --version
Next you will need to enable developer options and test the connectivity.
adb devices
If you have multiple devices attached, then you have to specify the device explicitly
adb -s <device_id> shell
If you only have 1 single device connected hence just
adb shell
Press Ctrl+d or type “exit”. Next check if you have the service “isms” running. You can only send SMS through ADB if you have this service.
adb shell service check isms
To send SMS, use the following command. Replace “+6587654321” with your recipient’s number. Replace “hello world” with the message you wish to send. I had successfully ran the command with Android 10.
adb shell service call isms 7 i32 0 s16 "null" s16 "+6587654321" s16 "null" s16 "'hello world'"
Although SMS permits 160 characters. I was only able to send up to 145 ASCII characters with the above command. So what are i32 and s16? i32 is integer and s16 is string.
The number 7 represent the 7th function in the ISms interface in Android Interface Definition Language (AIDL).