Skip to content

Instantly share code, notes, and snippets.

@adrianotadao
Last active December 16, 2016 18:10
Show Gist options
  • Save adrianotadao/0ae7f1ca85b79e5fbe0fe7b441ec088d to your computer and use it in GitHub Desktop.
Save adrianotadao/0ae7f1ca85b79e5fbe0fe7b441ec088d to your computer and use it in GitHub Desktop.
Send Paperbot email
## To access the paperbot
cd paperbot/current
bundle exec rails c
## To select the team
team = Team.last
## To get the user
user = team.users.where(email: '[email protected]').first
## To send weekly email
UserMailer.weekly(user).deliver_now
## To send daily email
UserMailer.daily(user).deliver_now
## To check if the user has daily links
daily_links = LinksFilter.new(user: user, type: :daily, end_hour: ENV['PAPERBOT_TZ_DAILY_MAIL_TIME'].to_i)
daily_links.each do |daily_links|
daily_links.links.each do |link|
p "=---------------"
p "=---------------"
p link
p "=---------------"
p "=---------------"
end
end
## To check if the user has weekly links
weekly_links = LinksFilter.new(user: user, type: :weekly, end_hour: ENV['PAPERBOT_TZ_WEEKLY_MAIL_TIME'].to_i)
weekly_links.each do |weekly_links|
weekly_links.links.each do |link|
p "=---------------"
p "=---------------"
p link
p "=---------------"
p "=---------------"
end
end
## Observations
# If you have problem to see the links, take a look at PAPERBOT_TZ_DAILY_MAIL_TIME env variable because in most of cases, you need to change this value.
# To change it, you need to do:
# 1 - sudo vim /etc/profile.d/skore.sh
# 2 - change the value
# 3 - open the console again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment