diff --git a/app/services/action_service.rb b/app/services/action_service.rb index 80caac392..b4900aad8 100644 --- a/app/services/action_service.rb +++ b/app/services/action_service.rb @@ -78,8 +78,11 @@ class ActionService emails = emails[0].gsub(/\s+/, '').split(',') emails.each do |email| + break unless @account.within_email_rate_limit? + email = parse_email_variables(@conversation, email) ConversationReplyMailer.with(account: @conversation.account).conversation_transcript(@conversation, email)&.deliver_later + @account.increment_email_sent_count end end diff --git a/app/services/automation_rules/action_service.rb b/app/services/automation_rules/action_service.rb index e409faba2..01833ba57 100644 --- a/app/services/automation_rules/action_service.rb +++ b/app/services/automation_rules/action_service.rb @@ -58,7 +58,10 @@ class AutomationRules::ActionService < ActionService teams = Team.where(id: params[0][:team_ids]) teams.each do |team| + break unless @account.within_email_rate_limit? + TeamNotifications::AutomationNotificationMailer.conversation_creation(@conversation, team, params[0][:message])&.deliver_now + @account.increment_email_sent_count end end end