"""
    Copyright (c) 2015-2019 Raj Patel(raj454raj@gmail.com), StopStalk

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:

    The above copyright notice and this permission notice shall be included in
    all copies or substantial portions of the Software.

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    THE SOFTWARE.
"""

db = current.db
atable = db.auth_user
query = (atable.registration_key == "") & \
        (atable.blacklisted == False)
rows = db(query).select(atable.stopstalk_handle, atable.email)

for row in rows:
    subject = "StopStalk Job Profile"
    message = """
<html>
Hello %s,<br/><br/>

We are here with an amazing announcement for you guys.<br/>
You might be looking for Job or Internship opportunites while you are busy solving interesting problems.<br/>
Let us know if you are interested in being contacted by companies looking to hire candidates like you.<br/><br/>

Update your <a href="https://www.stopstalk.com/job_profile?utm_source=newsletter&utm_medium=email&utm_campaign=job-profile&utm_content=job-page">StopStalk Job Profile</a> now by filling the required details on the page and we will contact you if we find a match.<br/>
We hope we can find you an apt place for your skills to grow.<br/><br/>

Cheers,<br/>
Team StopStalk<br/><br/>

--------------------------------<br/>
Adjust your email preferences <a href="https://www.stopstalk.com/unsubscribe?utm_source=newsletter&utm_medium=email&utm_campaign=job-profile&utm_content=unsubscribe">here</a>.<br/><br/>
</html>
              """ % row.stopstalk_handle
    current.send_mail(to=row.email,
                      subject=subject,
                      message=message,
                      mail_type="feature_updates",
                      bulk=True)

@@ -1373,37 +1373,52 @@
 ject = %22
-StopStalk Job Profile
+Get Amazon Gift cards from StopStalk
 %22%0A    me
@@ -1461,170 +1461,227 @@
 /%3E%0A%0A
-We are here with an amazing announcement for you guys.%3Cbr/%3E%0AYou might be looking for Job or Internship opportunites while you are busy solving inte
+Since the launch of the platform we have been excited to help you guys be good at Competitive Programming%3Cbr/%3E%0Aand in the process be great at problem solving. Just a slight push at times when you'
 re
+ 
 st
-ing
+uck with a
  problem
 s.%3Cb
@@ -1680,144 +1680,359 @@
 blem
-s.
 %3Cbr/%3E%0A
-Let us know if you are interested in being contacted by companies looking to hire candidates like you.%3Cbr/%3E%3Cbr/%3E%0A%0AUpdate your %3Ca
+can result into great learning.%3Cbr/%3E%3Cbr/%3E%0A%0AWe support writing editorials on StopStalk for various problems on 7 Competitive Programming websites.%3Cbr/%3E%0AContribute to the community and help people with the problems that you have solved.%3Cbr/%3E%0ATop 3 winners by the end of March will receive Amazon Gift cards from StopStalk - %3Ca style='color: blue;'
  hre
@@ -2064,19 +2064,23 @@
 com/
-job_profile
+user_editorials
 ?utm
@@ -2132,226 +2132,72 @@
 ign=
-job-profile&utm_content=job-page%22%3EStopStalk Job Profile%3C/a%3E now by filling the required details on the page and we will contact you if we find a match.%3Cbr/%3E%0AWe hope we can find you an apt place for your skills to grow.
+user-editorials&utm_content=user-editorials-page%22%3EKnow more.%3C/a%3E
 %3Cbr/
@@ -2242,16 +2242,58 @@
 /%3E%3Cbr/%3E%0A
+%3Cdiv style='font-size: 10px;color: grey;'%3E
 %0A-------
@@ -2355,16 +2355,60 @@
 ences %3Ca
+ style='text-decoration: none; color: grey;'
  href=%22h
@@ -2500,19 +2500,23 @@
 ign=
-job-profile
+user-editorials
 &utm
@@ -2541,14 +2541,21 @@
 be%22%3E
+%3Cu%3E
 here%3C/
+u%3E%3C/
 a%3E.%3C
@@ -2564,16 +2564,23 @@
 /%3E%3Cbr/%3E%0A
+%3C/div%3E%0A
 %3C/html%3E%0A
@@ -2817,9 +2817,8 @@
 lk=True)
-%0A

add newsletter content