def sendEmail(account_name, account_google_id, username, account_id): subject = "Account '%s' (%s) | Was Synced Successfully" % ( account_name, account_google_id) html_content = getHtmlContent(username, account_name) email_address = Helpers().getUserEmail(account_id) Log("info", "Sending account success email", "%s - send to: %s" % (subject, email_address), account_id) Email.send(("*****@*****.**", "AdEvolver"), str(email_address), subject, html_content)
def sendEmail(self): subject = "Account '%s' (%s) | All Campaigns were paused for the rest of the day" % (self.budget_commander.name, self.budget_commander.google_id) html_content = self.getHtmlContent() email_addresses = self.budget_commander.getEmailAddresses() Log("info", "Sending email(s)", "%s - send to: %s" % (subject, ",".join(email_addresses),), self.account_id) assert len(email_addresses) > 0 for email_address in email_addresses: # print email_address Email.send(("*****@*****.**", "AdEvolver Budget Commander"), str(email_address), subject, html_content)
def sendEmail(self): subject = "Account '%s' (%s) has gone over budget" % (self.name, self.google_id) html_content = self.getHtmlContent() email_addresses = self.getEmailAddresses() Log("info", "Sending email(s)", "%s - send to: %s" % ( subject, ",".join(email_addresses), ), self.account_id) assert len(email_addresses) > 0 for email_address in email_addresses: # print email_address Email.send(("*****@*****.**", "AdEvolver Budget Commander"), str(email_address), subject, html_content) self.markAsSent()
def test_send(self): try: subject = "Test Email" html_content = "Hi,<br><br>" html_content += "Test email" email_address = "*****@*****.**" (Email()).send( ("*****@*****.**", "AdEvolver Budget Commander"), str(email_address), subject, html_content ) except Exception as e: self.fail("send email failed")
def sendEmail(self, html_content): Email().send("*****@*****.**", "*****@*****.**", "AdEvolver %s" % (self.category), html_content) Email().send("*****@*****.**", "*****@*****.**", "AdEvolver %s" % (self.category), html_content)
def get_receivers(): receivers = [] with open('receivers.txt', 'r') as file: receivers.append(file.readline()) return receivers if __name__ == '__main__': bot = Bot() bot.add_receivers(get_receivers()) crawler = IndieGameBundlesCrawler() articles_published_today = crawler.crawl() email = Email() for article in articles_published_today: email.html_content = ''' <html> <body> <img style="width:100%;"src={img}> <div> <a href={url}> {desc} </a></div> </body> </html> '''.format(img=article['img'], desc=article['description'], url=article['url']) with open('game-finder/html_message.html', 'w') as file: file.write(email.html_content)
def get_receivers(): receivers = [] with open('receivers.txt', 'r') as file: receivers.append(file.readline()) return receivers if __name__ == '__main__': bot = Bot() bot.add_receivers(get_receivers()) crawler = CSUBBCrawler() articles_published_today = crawler.crawl() email = Email() for article in articles_published_today: imgTag = '<img style="width:100%;"src={}>'.format( article['img']) if article['img'] != '' else '' email.html_content = ''' <html> <body> {imgTag} <div> <a href={url}> {desc} </a></div> </body> </html> '''.format(imgTag=imgTag, desc=article['description'], url=article['url'])