public Task <string> SendAsync(SmsCarrierId carrierId, string toNumber, string subject, string body = null) { // Send SMS via (FREE) email. // NOTE: body is optional. // Via email. Will impose an odd style on the Text message. // Will look like: (empty subject is not allowed) // FRM: email name // SUBJ: xxx // MSG: stuff in body. (optional) // Any responses will be back to the sender email. string formTo; if (!_dicTo.TryGetValue(carrierId, out formTo)) { return(Task.FromResult("Unknown carrier for free SMS sending.")); } var msg = new EmailMessage(_mailFrom, false) { Subject = subject, Body = body, }; msg.AddMailTo(string.Format(formTo, toNumber)); return(_mailGateway.SendAsync(msg)); }
public static string GetEmailForm(SmsCarrierId carrierId) { // Get email gateway for SMS by provider. for Format("{0}",number). // https://www.lifewire.com/sms-gateway-from-email-to-sms-text-message-2495456 string formTo; if (_dicTo.TryGetValue(carrierId, out formTo)) { return(formTo); } return(null); }