小编Moh*_*003的帖子

无法在 C# 中使用 twilio 发送短信

我尝试使用 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)

.net c# twilio

3
推荐指数
1
解决办法
1315
查看次数

标签 统计

.net ×1

c# ×1

twilio ×1