Multi Sms Providers for .NET is a C# package designed to simplify the process of integrating multiple SMS service providers into your .NET application. The package is easy to use and includes support for various SMS providers such as Twilio, NetGSM, İleti Merkezi, JetSms, Mutlucell, Mas GSM and SmsVitrini.
Install NuGet\Install-Package MultiSms
package using NuGet to get started.
var _smsFactory = MultiSmsServiceFactory.Instance.UseOptions(options =>
{
options.DefaultOrginator = "test_orginator";
options.DefaultProvider = NetGsmProvider.Name;
})
.UseNetGsm("test_username", "test_password", "test_orginator")
.Create();
var message = MessageBody.Compose()
.To("+905325321221")
.WithContent("test message")
.Build();
var result = await _smsFactory.SendAsync(message);
builder.Services.AddMultiSms(options =>
{
options.DefaultProvider = NetGsmProvider.Name;
options.DefaultOrginator = "test_orginator";
})
.UseNetGsm(
username: "test_username"
password: "test_password",
orginator: "test_orginator"
);
public class NetGsmController : ControllerBase
{
private readonly ILogger<NetGsmController> _logger;
private readonly ISmsService _smsService;
public NetGsmController(ILogger<NetGsmController> logger, ISmsService smsService)
{
_logger = logger;
_smsService = smsService;
}
[HttpGet]
public async Task<SendingResult> Send(CancellationToken cancellationToken)
{
var message = MessageBody.Compose()
.To("+905325321221")
.WithContent("test message")
.Build();
return await _smsService.SendAsync(message, cancellationToken);
}
}