namespace :peoplefinder do

  def inadequate_profiles
    @inadequate_profiles = Person.inadequate_profiles
  end

  def inadequate_profiles_with_email
    inadequate_profiles.select { |person| person.email.present? }
  end

  desc 'list the email addresses of people with inadequate profiles'
  task inadequate_profiles: :environment do

    inadequate_profiles.each do |person|
      puts "#{ person.surname }, #{ person.given_name }: #{ person.email }"
    end
    puts "\n** There are #{ inadequate_profiles.count } inadequate profiles."
    puts "** #{ inadequate_profiles_with_email.count }
      inadequate profiles have email addresses."
    puts "\n"
  end

  desc 'email people with inadequate profiles'
  task inadequate_profile_reminders: :environment do
    recipients = inadequate_profiles_with_email

    puts "\nYou are about to email #{ recipients.count } people"
    puts 'Are you sure you want to do this? [Y/N]'

    if STDIN.gets.chomp == 'Y'
      recipients.each do |recipient|

        if EmailAddress.new(recipient.email).valid_address?
          ReminderMailer.inadequate_profile(recipient).deliver
          puts "Email sent to: #{ recipient.email }"

        else
          puts "Email *not* sent to: #{ recipient.email }"
        end
      end

    end
  end
end

namespace :peoplefinder do

  def inadequate_profiles
    @inadequate_profiles = Person.inadequate_profiles
  end

  def inadequate_profiles_with_email
    inadequate_profiles.select { |person| person.email.present? }
  end

  desc 'list the email addresses of people with inadequate profiles'
  task inadequate_profiles: :environment do

    inadequate_profiles.each do |person|
      puts "#{ person.surname }, #{ person.given_name }: #{ person.email }"
    end
    puts "\n** There are #{ inadequate_profiles.count } inadequate profiles."
    puts "** #{ inadequate_profiles_with_email.count }
      inadequate profiles have email addresses."
    puts "\n"
  end

  desc 'email people with inadequate profiles'
  task inadequate_profile_reminders: :environment do
    recipients = inadequate_profiles_with_email

    puts "\nYou are about to email #{ recipients.count } people"
    puts 'Are you sure you want to do this? [Y/N]'

    if STDIN.gets.chomp == 'Y'
      recipients.each do |recipient|
        ReminderMailer.inadequate_profile(recipient).deliver_now
        puts "Email sent to: #{ recipient.email }"
      end
    end
  end
end

Remove check of person's email validity in reminder email task
Remove check of person's email validity in reminder email task

Email validity is checked when person is created or updated.
All invalid email addresses in legacy production data have been
fixed.

So email is always valid and does not need to be checked here.
