Skip to content

Instantly share code, notes, and snippets.

@CH3COOH
Last active December 17, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CH3COOH/5520429 to your computer and use it in GitHub Desktop.
Save CH3COOH/5520429 to your computer and use it in GitHub Desktop.
Send SMS using Skype4COM for C# Detailed description: http://ch3cooh.jp/other/skype-api/send-msm-using-skypeapi/
using System;
using System.Diagnostics;
using System.Windows.Forms;
namespace SkypeAPISample
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var sendNumber = "+81-80-xxxx-yyyy";
var msgBody = "test message";
SendSMSMessage(sendNumber, msgBody);
}
/// <summary>
/// SMSを送信する
/// </summary>
/// <param name="number"></param>
/// <param name="body"></param>
void SendSMSMessage(string number, string body)
{
try
{
var skype = new SKYPE4COMLib.Skype();
skype.Timeout = 120 * 1000; // タイムアウト時間を2分にする (単位:ミリ秒)
var smsType = SKYPE4COMLib.TSmsMessageType.smsMessageTypeOutgoing;
var message = skype.CreateSms(smsType, number);
message.Body = body;
message.Send();
}
catch (Exception ex)
{
Debug.WriteLine(ex);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment