C# SMS API delivery failed
SMS delivery reports for failed SMS messages are handled the same way in the C# SMS API as SMS delivery reports for successful SMS delivery. The only difference is that the Ozeki SMS gateway raises the OnMessageDeliveryFailed event, and it attaches an error message to the report if the mobile network returns a delivery report with a failed status.
The C#/.Net SMS api sms delivery failed event
The sms delivery failed event in the C# SMS api arrives when the mobile network considers an SMS message undeliverable. This can happen if the destination mobile phone is never switched on or is roaming in an inaccessible network. Some SMS service providers do not send SMS delivery reports with failed status codes.
To handle the SMS delivery failed report in your C# SMS API follow these steps:
- Subscribe for the OnMessageDeliveryFailed event in your C# SMS API class
- Write the C# code to process the SMS delivery failed report
- Send an SMS, and save the sms message ID.
- Process the incoming SMS delivery failed report in your C# sms api class
C# sms api sms delivery failed report example:
Client.OnMessageDeliveryFailed += Client_OnMessageDeliveryFailed; static void Client_OnMessageDeliveryFailed(object sender, OzxArgs<string, DateTime, string> e) { Console.WriteLine("Message delivery failed. ID: " + e.Item1 + " Date: " + e.Item2 + " Reason: " + e.Item3); }
The C#/.NET sms api receives the date of failure and the error code in addition to the SMS messages ID of the originally sent SMS message.
For Android SMS Gateway setups, you receive this event, when the android phone receives the delivery failed report. If your SMS Server runs on a PC, this SMS delivery failed event will be triggered when the delivery failed report is received on the configure mobile network connection.
More information
- How to send SMS from C#
- Receive SMS in C#
- C# SMS API connect to send SMS
- C# SMS API - disconnect from SMS gateway
- C# SMS API - keepalive SMS connection alive
- C# SMS API - send a text message
- C# SMS API - SMS accepted for deliery event
- C# SMS API - SMS not accepted for delivery
- C# SMS API - submited
- C# SMS API - submit failed
- C# SMS API - delivery report successful
- C# SMS API - delivery failed report
- C# SMS API - alphanumeric sender ID
- C# SMS API how to use short code as sender ID
- C# SMS API text message class