Sending SMS from Dynamics NAV with 5 lines of code

Sending SMS from Dynamics NAV with 5 lines of code

After long time, I have found few minutes (ok, hour and something…) to test one idea I had. It is not long ago, when we switched our Exchange from older version to version 2010. Because I am using Windows Mobile 6.5 on my phone, I have noticed the new possibility to synchronize SMS from/to mobile with exchange/outlook. Bingo! If I am able to create the item in outlook from within NAV (and yes, I am able, I can create emails etc.), I can send SMS from NAV in this way. Easy!

What you need:

Outlook 2010

Exchange 2010

NAV (any version supporting automations…)

Mobile phone with Windows Mobile 6.1 (with some update) or 6.5

 

Step 1

Setup the mobile to synchronize all with the exchange, mainly the SMS. Just follow standard procedure, this blog is not about setting up the mobile phone…

Step 2

Create code in NAV, which will send the SMS. It is easy:

SendSMS(ToNumbers : Text[30];Body : Text[1000])

begin
  if ISCLEAR(OutlookApp) then
    CREATE(OutlookApp);

  MobileItem := OutlookApp.CreateItem(11); //11 – SMS, 12 – MMS
  MobileItem."To" := ToNumbers; //e.g. +420666777555
  MobileItem.Body := Body;
  MobileItem.Send(False);
end;

Where:

OutlookApp    Automation    'Microsoft Outlook 14.0 Object Library'.Application   
MobileItem     Automation    'Microsoft Outlook 14.0 Object Library'.MobileItem   

Step 3

Call the function where you need. You need to just run it under profile, which have outlook set to syncing SMS with phone. It will create the sms, and after the sms is synced into the mobile phone, the mobile phone will send the SMS for your wherever you want. If you want to have central sending machine, use the NAS or WebServices to send SMS based on some queue…

Conclusion

As you can see, you do not need to pay for some 3rd party service. You only need some mobile phone with good tarif. Of course, this is not good solution for some bulk sending, but for some standard notifications it is suitable.

Do not forget to make some maintenance of the outlook account, like deleting old sent items etc. You can do it through some code in NAV or may be somehow on the exchange.

And yes, you can read the incoming sms in similar way, just read the items from the outlook.

Some examples of usage:

Sending SMS to admin when session limit is reached (using NAS).

Sending SMS to customer when order is prepared to ship.

Generally: sending SMS when <some action> in NAV happen. :-)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值