-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5957291
commit 80b58fa
Showing
6 changed files
with
78 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
category_headline = '''<table width="600" border="0" cellpadding="0" cellspacing="0" class="force-row" style="width: 600px;"> | ||
<tr> | ||
<td class="content-wrapper" style="padding-left:24px;padding-right:24px"> | ||
<br> | ||
<div class="title" style="font-family:Helvetica, Arial, sans-serif;font-size:24px;font-weight:600;color:#374550">{0}</div> | ||
</td> | ||
</tr> | ||
''' | ||
|
||
|
||
def format_category_headline(category): | ||
return category_headline.format(category) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
from email_templates.news_headlines import format_headlines | ||
from email_templates.instagram import format_instagram_posts | ||
from email_templates.twitter import format_twitter_posts | ||
from email_templates.category_headline import format_category_headline | ||
from email_templates.construct_email import construct_email | ||
from email_templates.fallbacks import no_lists, no_social_posts | ||
from email_templates.general import format_count | ||
|
@@ -30,7 +31,8 @@ def send_sendgrid_email(email, html): | |
|
||
# Set the subject | ||
subject = "Your Daily NewsAI update" | ||
to_email = Email(email) | ||
to_email = Email('[email protected]') | ||
# to_email = Email(email) | ||
content = Content("text/html", html) | ||
mail = Mail( | ||
Email(SENDGRID_SENDER, "NewsAI"), subject, to_email, content) | ||
|
@@ -43,7 +45,7 @@ def send_sendgrid_email(email, html): | |
return | ||
|
||
|
||
def email_user_daily_feed(user, media_lists, posts): | ||
def email_user_daily_feed(user, media_lists, posts, emails): | ||
all_html = '' | ||
counts = [] | ||
for media_list in media_lists: | ||
|
@@ -98,6 +100,11 @@ def email_user_daily_feed(user, media_lists, posts): | |
# If the users has lists to share | ||
if len(counts) > 0: | ||
all_html += format_count(counts) | ||
all_html = format_category_headline('Social') + all_html | ||
|
||
if len(emails) > 0: | ||
all_html = format_category_headline('Email Analytics') + all_html | ||
|
||
final_html = construct_email(all_html) | ||
send_sendgrid_email(user['Email'], final_html) | ||
return | ||
|