开发者

Send a text message from R

I know you can send an email from R with sendMail, and you can tweet with twitteR. Is there any wa开发者_如何学Goy to send a text message from an R script?


All of the major US cell phone carriers allow you to send text messages using the standard email (SMTP) protocol. You can send a text message by sending an email to the phone. Here are the different email domains for the different carriers:

http://www.emailtextmessages.com/


I always struggled to get my mail configured correctly to send an email from R. But if you are on a Mac and use Mac Messages, you can send a text using Messages with an AppleScript.

So run the following code in R right in your script:

send_text = function(message){
    system(paste('osascript -e \'tell application "Messages"\' -e \'send "', message, '" to buddy "555-555-5555" of (service 1 whose service type is iMessage)\' -e \'end tell\''))
}

Just change the number to the phone number you want to text!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜