Page 1 of 1

Advertisment for Hotspot and not using the browser

Posted: Fri Nov 19, 2010 7:20 am
by namo
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.

Re: Advertisment for Hotspot and not using the browser

Posted: Fri Nov 19, 2010 7:54 am
by dssmiktik
Email? RouterOS can send email via user specified SMTP server.

Re: Advertisment for Hotspot and not using the browser

Posted: Sat Nov 20, 2010 2:24 am
by namo
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.

Re: Advertisment for Hotspot and not using the browser

Posted: Sat Nov 20, 2010 3:59 am
by dssmiktik
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...

Re: Advertisment for Hotspot and not using the browser

Posted: Sat Nov 20, 2010 4:12 am
by namo
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)

Re: Advertisment for Hotspot and not using the browser

Posted: Sat Nov 20, 2010 5:35 am
by romequis
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]
.
.
.

Re: Advertisment for Hotspot and not using the browser

Posted: Sat Nov 20, 2010 8:23 am
by namo
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?

Re: Advertisment for Hotspot and not using the browser

Posted: Sun Nov 21, 2010 2:36 am
by dssmiktik
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 :)

Re: Advertisment for Hotspot and not using the browser

Posted: Sun Nov 21, 2010 6:40 am
by namo
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 )?

Re: Advertisment for Hotspot and not using the browser

Posted: Sun Nov 21, 2010 10:45 am
by dssmiktik
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).

Re: Advertisment for Hotspot and not using the browser

Posted: Sun Nov 21, 2010 4:27 pm
by namo
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.