{"id":830,"date":"2018-09-24T11:29:47","date_gmt":"2018-09-24T07:29:47","guid":{"rendered":"http:\/\/blog.5flor.ru\/?p=830"},"modified":"2018-09-24T11:29:47","modified_gmt":"2018-09-24T07:29:47","slug":"mikrotik-%d0%be%d1%82%d0%bf%d1%80%d0%b0%d0%b2%d0%ba%d0%b0-%d1%81%d0%bc%d1%81-%d0%bd%d0%b0-e-mail","status":"publish","type":"post","link":"https:\/\/blog.5flor.ru\/?p=830","title":{"rendered":"Mikrotik \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043c\u0441 \u043d\u0430 e-mail"},"content":{"rendered":"<p>\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u0441 \u043a\u0430\u043a\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043c\u0441 \u0441 \u043c\u043e\u0434\u0435\u043c\u0430.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u0441\u043c\u0441 \u0441 \u0441\u0438\u043c\u043a\u0438 \u0441\u0442\u0438\u0440\u0430\u0435\u0442\u0441\u044f.<\/p>\n<p># DEBUGMODE &#171;True&#187;<\/p>\n<p>:local DEBUGMODE &#171;False&#187;<br \/>\n# EMail<br \/>\n:local DSTEMail &#171;test@mail.ru&#187;<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;sms 2 email DEBUG &#8230;&#187;;}<\/p>\n<p>\/tool sms set receive-enabled=yes<br \/>\n:delay 30s<\/p>\n<p>:local SMSMSG &#171;&#187;<br \/>\n:local SMSPHONE &#171;&#187;<br \/>\n:local SMSDate &#171;&#187;<br \/>\n:local InboxSMSCount [\/tool sms inbox print count-only]<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;INBOX SMS Count: $InboxSMSCount&#187;;}<br \/>\n:if ($InboxSMSCount &gt;0) do={<\/p>\n<p>:local InBoxSMSArray [:toarray [\/tool sms inbox find]]<\/p>\n<p>:foreach CurrentSMS in=$InBoxSMSArray do={<\/p>\n<p>:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;SMS ID# $CurrentSMS&#187;;}<br \/>\n:set SMSPHONE [ \/tool sms inbox get value-name=phone number=$CurrentSMS ];<br \/>\n:set SMSDate [ \/tool sms inbox get value-name=timestamp number=$CurrentSMS ];<br \/>\n:set SMSMSG [ \/tool sms inbox get value-name=message number=$CurrentSMS ];<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info $SMSPHONE;}<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info $SMSDate;}<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info $SMSMSG;}<\/p>\n<p>:if ( [:len $SMSMSG] &gt;0 ) do={<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;Sending SMS 2 EMail $DSTEMail &#8230;.&#187;;}<br \/>\n\/tool e-mail send to=$DSTEMail body=&#187;PHONE: $SMSPHONE\\nDATE: $SMSDate\\nMSG: $SMSMSG&#187; subject=&#187;AR SMS-Gateway INBOX SMS#$CurrentSMS&#187;<br \/>\n}<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;Clearing INBOX SMS# $CurrentSMS&#187;;}<br \/>\n\/tool sms inbox remove numbers=$CurrentSMS<\/p>\n<p>}<\/p>\n<p>} else {:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;INBOX empty&#187;;} }<br \/>\n:if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;Sending SMS 2 EMail COMPLITED!!!&#187;;}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u0432\u0435\u0441\u0442\u0438 \u0437\u0430\u0434\u0430\u043d\u0438\u0435 \u0432 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0435 \u0441 \u043a\u0430\u043a\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e \u0447\u0438\u0442\u0430\u0442\u044c \u0441\u043c\u0441 \u0441 \u043c\u043e\u0434\u0435\u043c\u0430. \u041f\u043e\u0441\u043b\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430 \u043f\u043e\u0447\u0442\u0443 \u0441\u043c\u0441 \u0441 \u0441\u0438\u043c\u043a\u0438 \u0441\u0442\u0438\u0440\u0430\u0435\u0442\u0441\u044f. # DEBUGMODE &#171;True&#187; :local DEBUGMODE &#171;False&#187; # EMail :local DSTEMail &#171;test@mail.ru&#187; :if ( $DEBUGMODE=&#187;True&#187; ) do={\/log info &#171;sms 2 &hellip; <a href=\"https:\/\/blog.5flor.ru\/?p=830\">\u0427\u0438\u0442\u0430\u0442\u044c \u0434\u0430\u043b\u0435\u0435 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-830","post","type-post","status-publish","format-standard","hentry","category-mikrotik"],"_links":{"self":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/830"}],"collection":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=830"}],"version-history":[{"count":0,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=\/wp\/v2\/posts\/830\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5flor.ru\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}