I have created test account and using test ID and TOken for sending sms using mvc c# the code excutes successfully but it is not sending any sms .
var accountSid = "AC5e25d8a4266b39ac8769cd1f6ee0c6cc3";
var authToken = "e8c21c9556cf64a75066f12cfa96c";
TwilioClient.Init(accountSid, authToken);
try
{
MessageResource.CreateAsync(
body: "There's always money in the banana stand.",
from: new PhoneNumber("+16073502552"),
to: new PhoneNumber("+923219494158")
);
}
catch (ApiException ex)
{
if (ex.Code == 21614)
{
Console.WriteLine("Uh oh, looks like this caller can't receive SMS messages.");
}
}
I read many articles someone said that for test account the from number need to be fixed like this "+15005550006" I did that as well . but it sucessfully run without sending any message when i use their portal to send the message with same credentials it works
Mark TaborPosted Apr 30, 2023, 4:08 PM
thanks rajkiran I have already added my phone there and verified although I did not get verification code or call i remove and try to add again but i am not gettng any code to input
Rajkiran SwainPosted Apr 30, 2023, 1:56 PM
For a Twilio test account, SMS messages can only be sent to verified numbers that have been added to the account. This is done to prevent spam and abuse on the test platform. If you are trying to send a message to a number that has not been verified, the message will not be delivered.
To verify a number, you can follow these steps:
Once the number is verified, you should be able to send SMS messages to that number using your test account credentials.
Also, please make sure that your Twilio test account has sufficient balance to send messages. You can check your account balance in the Twilio Console.