combined consumer and proxy into minimal rails backed
This commit is contained in:
31
tests/test_sending_emails.rb
Normal file
31
tests/test_sending_emails.rb
Normal file
@ -0,0 +1,31 @@
|
||||
# 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
|
Reference in New Issue
Block a user