Class: MailCatcher::SmtpTls

Inherits:
Smtp
  • Object
show all
Defined in:
lib/mail_catcher/smtp.rb

Overview

Direct TLS (SMTPS) handler that starts TLS immediately on connection

Instance Method Summary collapse

Methods inherited from Smtp

connection_count, #current_message, #get_server_capabilities, #initialize, #log_transcript, #process_mail_from, #process_starttls, #process_unknown, #receive_data_chunk, #receive_ehlo_domain, #receive_message, #receive_plain_auth, #receive_recipient, #receive_reset, #receive_sender, #save_transcript, #unbind

Constructor Details

This class inherits a constructor from MailCatcher::Smtp

Instance Method Details

#post_initObject



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/mail_catcher/smtp.rb', line 300

def post_init
  # Increment connection count and set up connection info
  super

  # Log immediate TLS (SMTPS on port 1465)
  log_transcript('tls', 'server', 'Immediate TLS enabled (SMTPS)')

  # Start TLS immediately on connection for SMTPS (port 1465 behavior)
  # The @@parms hash with starttls_options is already set by configure_smtp_ssl!
  if defined?(@@parms) && @@parms[:starttls_options]
    start_tls(@@parms[:starttls_options])

    # Log TLS details after negotiation
    if @tls_started
      begin
        protocol = get_cipher_protocol
        cipher = get_cipher_name
        log_transcript('tls', 'server', "TLS negotiation completed (#{protocol}, #{cipher})")
      rescue
        # TLS info not available yet
      end
    end
  end
end