Class: Porteo::Pony_gateway
- Defined in:
- lib/gateways/pony_gateway.rb
Overview
Gateway to use an email service with Pony gems. In Porteo system, this class acts as a link between any email protocol and Pony gem.
This class inherits from Gateway class and just overwrite the method send_message.
Constant Summary collapse
- PONY_OPTIONS =
Options allowed for Pony API. If you want to add any of these options do it in message sections.
[ :to, :cc, :bcc, :from, :body, :html_body, :subject, :charset, :attachments, :headers, :message_id, :sender ]
- VIA_OPTIONS =
Via configuration options. The sending method is configured with these options.
[ :address, :port, :user_name, :password, :enable_starttls_auto, :authentication, :domain, :location, :argument ]
Instance Method Summary collapse
-
#send_message(message_sections) ⇒ nil
Send the message defined in parameter.
Methods inherited from Gateway
connection_argument, #connection_arguments, #init_send, #initialize
Constructor Details
This class inherits a constructor from Porteo::Gateway
Instance Method Details
#send_message(message_sections) ⇒ nil
Send the message defined in parameter.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/gateways/pony_gateway.rb', line 74 def ( ) # Create options hash to Pony pony_config = {} # Recover data from template # We look for each option defined before in the message content PONY_OPTIONS.each do |opt| pony_config[opt] = [opt] if [opt] != nil end # Recover data from send options # First we get the via used to send the message pony_config[:via] = @config[:via] # Then we look for the other configuration options pony_config[:via_options] = {} VIA_OPTIONS.each do |opt| pony_config[:via_options][opt] = @config[:via_options][opt] if @config[:via_options][opt] != nil end # Send the message Pony.mail( pony_config ) end |