Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to skip a mailing? #26

Open
0xD7ba952CE8A0976e8d9852b7649bf01c30146 opened this issue Jan 7, 2017 · 1 comment
Open

How to skip a mailing? #26

0xD7ba952CE8A0976e8d9852b7649bf01c30146 opened this issue Jan 7, 2017 · 1 comment

Comments

@0xD7ba952CE8A0976e8d9852b7649bf01c30146

I'm trying to skip a mailing when a condition I provide is false.
Please see the following code snippet:

  config.sequence :paid_onboarding do |seq|
    seq.title = "Paid Onboarding"
    seq.list = :paid_users
    seq.start_at = Proc.new { |user| user.account.subscription_end - 30.days } # days that have passed since subscription will be used in absolute_delay mailings below
    seq.enable

    # I WANT TO SKIP THIS MAILING FROM BEING SENT WHEN A CONDITION I PASS RETURNS FALSE
    # For example: Time.now < (user.account.subscription_end + 45.days)
    seq.mailing :subscription_ended_email_45 do |mailing|
      mailing.title = "Subscription ended 45 days ago"
      mailing.absolute_delay = 75.days
      mailing.mailer_name = "UserMailer"
      mailing.enable
    end
  end

Question: Is maily_herald capable of handle conditionals to determine whether or not an email must be sent?
If not, what other alternatives I have to accomplish my goal?

@joshmn
Copy link

joshmn commented Mar 31, 2017

I know this is old, but someone is probably going to ask this too.

Take a look at how start_at is called, and create another method named skip_if(&block); if block true, skip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants