我尝试使用 twilio 网站上的示例代码发送短信,但收到错误“TLS 协议无效”。我使用了有效的 accountid、authtoken 和经过验证的手机号码。
class Program
{
static void Main(string[] args)
{
string accountSid = Environment.GetEnvironmentVariable("TWILIO_ACCOUNT_SID");
string authToken = Environment.GetEnvironmentVariable("TWILIO_AUTH_TOKEN");
TwilioClient.Init(accountSid, authToken);
var message = MessageResource.Create(
body: "Hi there",
from: new Twilio.Types.PhoneNumber("+15017122661"),
to: new Twilio.Types.PhoneNumber("+15558675310")
);
Console.WriteLine(message.Sid);
}
}
Run Code Online (Sandbox Code Playgroud)