{"id":1824,"date":"2022-09-30T21:45:18","date_gmt":"2022-09-30T19:45:18","guid":{"rendered":"https:\/\/www.daniel-ritter.de\/blog\/?p=1824"},"modified":"2024-05-13T01:08:35","modified_gmt":"2024-05-12T23:08:35","slug":"small-sms-gateway-with-tasker-android-and-a-webserver","status":"publish","type":"post","link":"https:\/\/www.daniel-ritter.de\/blog\/small-sms-gateway-with-tasker-android-and-a-webserver\/","title":{"rendered":"Small SMS to Email gateway with Tasker, Android and a webserver"},"content":{"rendered":"<p>I wanted to forward SMS text messages to email. Tasker has an email action, but it won&#8217;t automatically send the email, just provide the composing window.<\/p>\n<p>Gladly Tasker can do HTTP-requests and read SMS, so we can forward the SMS to our own webserver to mail it from there.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Tasker part:<\/strong><\/p>\n<ul>\n<li>Create Profile &#8222;Incoming SMS&#8220;<\/li>\n<li>Make it run Task &#8222;SMS2Email&#8220; when Event &#8222;Received Text SMS&#8220; is triggered.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li>Create new Task &#8222;SMS2Email&#8220;<\/li>\n<li>In Task &#8222;SMS2Email:<\/li>\n<li>Make sure mobile data is turned on<\/li>\n<li>Do the following HTTP POST Action:<\/li>\n<\/ul>\n<p>Server: https:\/\/www.myserver.com<\/p>\n<p>Path: smsgateway.php<\/p>\n<p>Data \/ File: sms=%SMSRF \/ %SMSRN \/ %SMSRB \/ %MMSRS \/ %SMSRD \/ %SMSRT<\/p>\n<p>Trust any certificate: check<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Webserver part on www.myserver.com:<\/strong><\/p>\n<pre># \/var\/www\/smsgateway.php\r\n&lt;?php\r\n$sms = $_POST[\"sms\"];\r\n$sms_parts = explode(\"\/\", $sms);\r\n\r\n$sms_num = $sms_parts[0];\r\n$sms_nam = $sms_parts[1];\r\n$sms_txt = $sms_parts[2];\r\n$sms_dat = $sms_parts[4];\r\n$sms_tim = $sms_parts[5];\r\n\r\n$body =\"\r\n$sms_dat $sms_tim\r\n$sms_num\r\n$sms_nam\r\n\r\n$sms_txt\r\n\";\r\n\r\nmail(\"targetemail@myserver.com\", \"SMS $sms_nam $sms_num\", $body, \"From: Snappy Sendername &lt;smsservice@myserver.com&gt;\");\r\n?&gt;\r\n<\/pre>\n<p>Here we go. After receiving a SMS, Tasker makes the HTTP-request, delivering the content of the SMS to the webserver. PHP sends the content out by mail.<\/p>\n<p>If you don&#8217;t want to forward all SMS, you can add additional filters in Taskers event &#8222;Received Text SMS&#8220;.<\/p>\n<p>Make sure your PHP setup is able to deliver mail. Check if messages go to spam.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to forward SMS text messages to email. Tasker has an email action, but it won&#8217;t automatically send the email, just provide the composing window. Gladly Tasker can do HTTP-requests and read SMS, so we can forward the SMS to our own webserver to mail it from there. &nbsp; Tasker part: Create Profile &#8222;Incoming [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1882,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[228],"tags":[],"class_list":["post-1824","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-android"],"_links":{"self":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts\/1824","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/comments?post=1824"}],"version-history":[{"count":11,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts\/1824\/revisions"}],"predecessor-version":[{"id":1886,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/posts\/1824\/revisions\/1886"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/media\/1882"}],"wp:attachment":[{"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/media?parent=1824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/categories?post=1824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.daniel-ritter.de\/blog\/wp-json\/wp\/v2\/tags?post=1824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}