Class: Nanobot::Config::EmailConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/nanobot/config/schema.rb

Overview

Email channel configuration for IMAP polling and SMTP replies

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(enabled: false, consent_granted: false, imap_host: nil, imap_port: 993, imap_username: nil, imap_password: nil, imap_mailbox: 'INBOX', imap_use_ssl: true, smtp_host: nil, smtp_port: 587, smtp_username: nil, smtp_password: nil, smtp_use_tls: true, smtp_use_ssl: false, from_address: nil, auto_reply_enabled: true, poll_interval_seconds: 30, mark_seen: true, max_body_chars: 12_000, subject_prefix: 'Re: ', allow_from: []) ⇒ EmailConfig

Returns a new instance of EmailConfig.

Parameters:

  • enabled (Boolean) (defaults to: false) —

    whether the email channel is active

  • consent_granted (Boolean) (defaults to: false) —

    user consent for automated email replies

  • imap_host (String, nil) (defaults to: nil) —

    IMAP server hostname

  • imap_port (Integer) (defaults to: 993) —

    IMAP server port

  • imap_username (String, nil) (defaults to: nil) —

    IMAP login username

  • imap_password (String, nil) (defaults to: nil) —

    IMAP login password

  • imap_mailbox (String) (defaults to: 'INBOX') —

    IMAP mailbox to poll

  • imap_use_ssl (Boolean) (defaults to: true) —

    use SSL for IMAP connection

  • smtp_host (String, nil) (defaults to: nil) —

    SMTP server hostname

  • smtp_port (Integer) (defaults to: 587) —

    SMTP server port

  • smtp_username (String, nil) (defaults to: nil) —

    SMTP login username

  • smtp_password (String, nil) (defaults to: nil) —

    SMTP login password

  • smtp_use_tls (Boolean) (defaults to: true) —

    use STARTTLS for SMTP

  • smtp_use_ssl (Boolean) (defaults to: false) —

    use implicit SSL for SMTP

  • from_address (String, nil) (defaults to: nil) —

    sender address for outgoing replies

  • auto_reply_enabled (Boolean) (defaults to: true) —

    automatically reply to incoming emails

  • poll_interval_seconds (Integer) (defaults to: 30) —

    seconds between IMAP polls

  • mark_seen (Boolean) (defaults to: true) —

    mark processed emails as seen

  • max_body_chars (Integer) (defaults to: 12_000) —

    truncate email body beyond this length

  • subject_prefix (String) (defaults to: 'Re: ') —

    prefix prepended to reply subjects

  • allow_from (Array<String>) (defaults to: []) —

    allowed sender addresses



220
221
222
223
224
225
226
227
228
229
230
# File 'lib/nanobot/config/schema.rb', line 220

def initialize(
  enabled: false, consent_granted: false,
  imap_host: nil, imap_port: 993, imap_username: nil, imap_password: nil,
  imap_mailbox: 'INBOX', imap_use_ssl: true,
  smtp_host: nil, smtp_port: 587, smtp_username: nil, smtp_password: nil,
  smtp_use_tls: true, smtp_use_ssl: false, from_address: nil,
  auto_reply_enabled: true, poll_interval_seconds: 30, mark_seen: true,
  max_body_chars: 12_000, subject_prefix: 'Re: ', allow_from: []
)
  super
end

Instance Attribute Details

#allow_from ⇒ Object

Returns the value of attribute allow_from

Returns:

  • (Object) —

    the current value of allow_from



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def allow_from
  @allow_from
end

#auto_reply_enabled ⇒ Object

Returns the value of attribute auto_reply_enabled

Returns:

  • (Object) —

    the current value of auto_reply_enabled



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def auto_reply_enabled
  @auto_reply_enabled
end

Returns the value of attribute consent_granted

Returns:

  • (Object) —

    the current value of consent_granted



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def consent_granted
  @consent_granted
end

#enabled ⇒ Object

Returns the value of attribute enabled

Returns:

  • (Object) —

    the current value of enabled



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def enabled
  @enabled
end

#from_address ⇒ Object

Returns the value of attribute from_address

Returns:

  • (Object) —

    the current value of from_address



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def from_address
  @from_address
end

#imap_host ⇒ Object

Returns the value of attribute imap_host

Returns:

  • (Object) —

    the current value of imap_host



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def imap_host
  @imap_host
end

#imap_mailbox ⇒ Object

Returns the value of attribute imap_mailbox

Returns:

  • (Object) —

    the current value of imap_mailbox



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def imap_mailbox
  @imap_mailbox
end

#imap_password ⇒ Object

Returns the value of attribute imap_password

Returns:

  • (Object) —

    the current value of imap_password



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def imap_password
  @imap_password
end

#imap_port ⇒ Object

Returns the value of attribute imap_port

Returns:

  • (Object) —

    the current value of imap_port



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def imap_port
  @imap_port
end

#imap_use_ssl ⇒ Object

Returns the value of attribute imap_use_ssl

Returns:

  • (Object) —

    the current value of imap_use_ssl



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def imap_use_ssl
  @imap_use_ssl
end

#imap_username ⇒ Object

Returns the value of attribute imap_username

Returns:

  • (Object) —

    the current value of imap_username



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def imap_username
  @imap_username
end

#mark_seen ⇒ Object

Returns the value of attribute mark_seen

Returns:

  • (Object) —

    the current value of mark_seen



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def mark_seen
  @mark_seen
end

#max_body_chars ⇒ Object

Returns the value of attribute max_body_chars

Returns:

  • (Object) —

    the current value of max_body_chars



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def max_body_chars
  @max_body_chars
end

#poll_interval_seconds ⇒ Object

Returns the value of attribute poll_interval_seconds

Returns:

  • (Object) —

    the current value of poll_interval_seconds



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def poll_interval_seconds
  @poll_interval_seconds
end

#smtp_host ⇒ Object

Returns the value of attribute smtp_host

Returns:

  • (Object) —

    the current value of smtp_host



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def smtp_host
  @smtp_host
end

#smtp_password ⇒ Object

Returns the value of attribute smtp_password

Returns:

  • (Object) —

    the current value of smtp_password



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def smtp_password
  @smtp_password
end

#smtp_port ⇒ Object

Returns the value of attribute smtp_port

Returns:

  • (Object) —

    the current value of smtp_port



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def smtp_port
  @smtp_port
end

#smtp_use_ssl ⇒ Object

Returns the value of attribute smtp_use_ssl

Returns:

  • (Object) —

    the current value of smtp_use_ssl



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def smtp_use_ssl
  @smtp_use_ssl
end

#smtp_use_tls ⇒ Object

Returns the value of attribute smtp_use_tls

Returns:

  • (Object) —

    the current value of smtp_use_tls



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def smtp_use_tls
  @smtp_use_tls
end

#smtp_username ⇒ Object

Returns the value of attribute smtp_username

Returns:

  • (Object) —

    the current value of smtp_username



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def smtp_username
  @smtp_username
end

#subject_prefix ⇒ Object

Returns the value of attribute subject_prefix

Returns:

  • (Object) —

    the current value of subject_prefix



189
190
191
# File 'lib/nanobot/config/schema.rb', line 189

def subject_prefix
  @subject_prefix
end