namespace :fourrure do
  desc "TODO"
  
  
  task import: :environment do
    @file = File.open(Rails.root.join('import_csv/fourrure_clean_mail.csv')).read
    
    r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/)     
    @emails = @file.scan(r).uniq 
    
    @emails.each do |mail|
      fs = FourrureSender.new(:email => mail, :cgv => true, :name => "NA", :firstname => "NA", :imported => true)
      fs.save
      puts mail
    end
    
  end
  

end
