# frozen_string_literal: true require 'mail' require 'bunny' require 'securerandom' @default_smtp_settings = { address: 'localhost', port: '2025', user_name: 'hello', password: 'world', enable_starttls_auto: true, authentication: 'plain', openssl_verify_mode: 'none' } def send_mail(index) mail = Mail.new( from: "test-#{index}-#{SecureRandom.uuid}@thefactory.local", to: "#{SecureRandom.uuid}@acme.local", cc: "cc-#{SecureRandom.uuid}@acme.local", bcc: "bcc-#{SecureRandom.uuid}@acme.local", subject: "Testing #{index}", ) mail.delivery_method :smtp, @default_smtp_settings mail.deliver! end number_of_emails = ARGV[0] || 1 send_mail number_of_emails