def send_invite(sender, subject_name, email_address): import os from google.appengine.api import mail from accounts.mail import mail_footer, get_sender if not mail.is_email_valid(email_address): logging.warning("%s is not a valid email", email_address) return False message = mail.EmailMessage() message.sender = get_sender() message.subject = sender.fullname + "has invited you to contribute quiz material" message.to = email_address message.body = """ %s has invited you to contribute to the %s quiz subject at PlopQuiz.com. You can respond to this invitation at the following link: %s Warm Regards, James Team PlopQuiz %s """ % (sender.fullname, subject_name, "http://" + str(os.environ['HTTP_HOST']) + "/subject/" + subject_name, mail_footer()) message.send()
def beta_message(self, recipient): from utils.utils import ROOT_PATH file = open(ROOT_PATH + "/data/new_years.pdf") pdf_str = file.read() message = mail.EmailMessage() message.sender = get_sender() message.subject = "A Holiday Greeting from PlopQuiz!" message.to = recipient.email message.body = """ Hello? Hello? Testing.... %s, I'm sending this email from a program I wrote in a computer language called Python, and the program is being compiled in a Google server farm located in Iowa. Not impressed? Well, you are still reading this, so I'll take that as a good sign. I may have told you about a website I'm working on called PlopQuiz. While it will be a little while until the site is ready for public usage, I wanted to give you a peek at what we've got under construction. You can take a quiz at http://blog.plopquiz.com. Use Firefox 3 if possible. This company blog is actually run from a different server than the main PlopQuiz site, and it shows how our new ability to administer quizzes "cross-domain" will open up some new possibilities for how we can distribute quizzes. If you browse down you should see a little "widget" with a "Misconceptions" header and a button saying "Take Quiz" on it. The topic of the quiz (popular misconceptions) probably won't be too much like the other subjects we'll be publishing this spring, but at least it will give you an idea of what it's like to take a quiz. After taking the quiz, you'll be prompted to login (you can use an account with any of the displayed services). You'll then be redirected to your profile. We lowered our grading standards for now, so it's very likely that you may have won an award or sponsorship. There's not much else you can do with the site right now, but we'd like to begin getting feedback as early as possible. Here are some specific questions that we'd be interested in hearing feedback on: * What do you think the PlopQuiz website does? Who is it for? * Would you ever have use for a site like PlopQuiz? What would be needed for it to be useful for you? * What do you predict would be the biggest challenge of this website? You can respond to this e-mail, or you can reach me at [email protected]. Be well, and good luck in the new year. -- James """ % recipient.fullname message.attachments = [("PlopQuiz_News_Years_Resolution.pdf", pdf_str)] message.send()