Skip to main content
Code Review

Return to Question

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
added 14 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

Kindly review this email sending Email-sending class for GAE

Kindly review this email sending class for GAE

Email-sending class for GAE

Please review this:

Background

Source Link

Kindly review this email sending class for GAE

class KoolDailyReminderAfterWeek(webapp2.RequestHandler):
 def get(self):
 logging.info('sending reminders')
 timeline = datetime.now () - timedelta (days = 7)
 edge = datetime.now () - timedelta (days = 8)
 ads = Ad.all().filter("published =", True).filter("added <", timeline).filter("url IN", ['www.koolbusiness.com']).filter("added >", edge).fetch(99999)
 for ad in ads:
 logging.info('sending reminder to %s', ad.name)
 if ad.title:
 subject= ad.title
 else:
 subject = 'Reminder'
 message = mail.EmailMessage(sender='Kool Business <[email protected]>', subject=subject)
 message.body = """
 Hello!<br>Now your ad <a href="http://www.koolbusiness.com/vi/%d.html">%s</a> has been out for a week. If you already have sold your product you can remove your ad.<br><br>Some advice to promote your ad:<br>Change + Renew the ad and it will be on top of the list. You can also change text and price.<br>Change the ad if you only want to lower the price or change the ad text<br>Renew so that the ad will be on top if the list. <br><br>Best regards,<br>Koolbusiness.com
 """ % (ad.key().id(),ad.title)
 message.html = """
 <html><head></head><body>
 Hello!<br>Now your ad <a href="http://www.koolbusiness.com/vi/%d.html">%s</a> has been out for a week. If you already have sold your product you can remove your ad.<br><br>Some advice to promote your ad:<br>Change + Renew the ad and it will be on top of the list. You can also change text and price.<br>Change the ad if you only want to lower the price or change the ad text<br>Renew so that the ad will be on top if the list. <br><br>Best regards,<br>Koolbusiness.com
 </body></html>
 """ % (ad.key().id(),ad.title)
 message.to=ad.email
 message.send()
 logging.info('sent email to: ' +ad.email)

YAML

 - description: daily mailout
 url: /report/dailyafterweek
 schedule: every 24 hours

Background:http://stackoverflow.com/questions/17767524/email-framework-for-appengine

lang-py

AltStyle によって変換されたページ (->オリジナル) /