Community discussions

MikroTik App
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Advertisment for Hotspot and not using the browser

Fri Nov 19, 2010 7:20 am

Hello,
I have Mikrotik routerOS v4.13 with hotspot setting.

I have activated "Advertise" in user profile for the users that didn't pay for the internet. Advertise interval get shorter as days passed. But there are some people who only use only windows live messenger or open the browser for short time and download most of the time using a download manager program without saying the ADs to remind them to pay.

My only solution now to but time in advertise timeout but this way the internet will disconnect until they open the browser.

Is there a way so the user can get payment reminder even if they are not using the browser for long time.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Advertisment for Hotspot and not using the browser

Fri Nov 19, 2010 7:54 am

Email? RouterOS can send email via user specified SMTP server.
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Re: Advertisment for Hotspot and not using the browser

Sat Nov 20, 2010 2:24 am

Email? RouterOS can send email via user specified SMTP server.
Thank you for your reply:
I have gmail setup to send backup file. I know that I need to fill in email for each user in hotspot.

what script should I use to send email for all users in user profile "128kbps money" and "256kbps money"?

will there be error if one of the user has no email filled in the hotspot?

will there be high traffic from the server if it is sending emails for 30 users?

Note: all my users has hotmail email and I notice that sometimes has problem receiving email from my server but it is worth trying.
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Advertisment for Hotspot and not using the browser

Sat Nov 20, 2010 3:59 am

If a user has not paid, you could set their profile to "NoPay", for example.

As for a script, something like this:
:local Email
:local Name
:local Profile

/ip hotspot user {
   :foreach u in=[find] do={
      :set Email [get $u email]
      :set Name [get $u name]
      :set Profile [get $u profile]

#   If user is in 'NoPay' profile, send them email
      :if ($Profile = "NoPay") do={

#      If user has an email address, send it
         :if ([:len $Email] > 0) do={
            :put ("Sending email to user: " . $Name . " email: " . $Email)
            /tool e-mail send \
                  to=$Email \
                  subject="Pay up" \
                  body=("You have not paid for service.  Send payment to xyz or email to: xyz for assistance") \
                  tls=(yes or no)

#      If user does not have email address, log it
         } else={
            /log error ("NoPayment: User " . $Name . " has not paid, but has no email address.  Could not email this user.")
         }

#   if $Profile = "NoPay"
      }

# foreach u
   }

# /ip hotspot user
}
Then you could schedule this script to run every 1day, 1week, 2month, etc...
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Re: Advertisment for Hotspot and not using the browser

Sat Nov 20, 2010 4:12 am

thank you dssmiktik but I have two notes:


1) how to increase the font size in the email body?

2) what should I add to send for the enabled user only? ( I might have some disabled users who has no internet this month or just leave the service but I didn't delete them)
 
romequis
just joined
Posts: 1
Joined: Thu Nov 11, 2010 5:02 pm

Re: Advertisment for Hotspot and not using the browser

Sat Nov 20, 2010 5:35 am

To send mail only to those enabled, simply pass the parameter in the foreach find.

Example:
/ip hotspot user {
:foreach u in=[find disabled=no] do={
:set Email [get $u email]
:set Name [get $u name]
:set Profile [get $u profile]
.
.
.
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Re: Advertisment for Hotspot and not using the browser

Sat Nov 20, 2010 8:23 am

After trying I find that I can replace the line
 :foreach u in=[find] do={
wiith
 :foreach u in=[find disabled=no] do={
Is there a way to change the font size in email body? Or use other languages such as Arabic?
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Advertisment for Hotspot and not using the browser

Sun Nov 21, 2010 2:36 am

Is there a way to change the font size in email body? Or use other languages such as Arabic?
1) As for font size, you'd probably want to insert HTML into your body message.

2) As for other languages, I've only worked in English, so I can't say for sure. I don't believe Mikrotik supports Unicode, only 7-bit ASCII (0 - 255).

Hope this answers all your questions :)
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Re: Advertisment for Hotspot and not using the browser

Sun Nov 21, 2010 6:40 am

Is there a way to change the font size in email body? Or use other languages such as Arabic?
1) As for font size, you'd probably want to insert HTML into your body message.

2) As for other languages, I've only worked in English, so I can't say for sure. I don't believe Mikrotik supports Unicode, only 7-bit ASCII (0 - 255).

Hope this answers all your questions :)
Does email body accept all html codes (url , picture,...etc )?
 
dssmiktik
Forum Veteran
Forum Veteran
Posts: 732
Joined: Fri Aug 17, 2007 8:42 am

Re: Advertisment for Hotspot and not using the browser

Sun Nov 21, 2010 10:45 am

Does email body accept all html codes (url , picture,...etc )?
Yes it does, it accepts any text you want to put in, in raw form. Pictures might have to be encoded with base64 encoding (I haven't done extensive testing of base64 however).
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Re: Advertisment for Hotspot and not using the browser

Sun Nov 21, 2010 4:27 pm

Does email body accept all html codes (url , picture,...etc )?
Yes it does, it accepts any text you want to put in, in raw form. Pictures might have to be encoded with base64 encoding (I haven't done extensive testing of base64 however).
This is not the same as html in front page. It looks longer code.

Who is online

Users browsing this forum: Bing [Bot], JohnTRIVOLTA, pajapatak, patrikg and 83 guests