Class: CapybaraSimpleEmailer

Inherits:
Object
  • Object
show all
Includes:
Capybara::DSL
Defined in:
lib/capybara_simple_emailer.rb,
lib/capybara_simple_emailer/version.rb

Constant Summary collapse

VERSION =
"0.1.1"

Instance Method Summary collapse

Instance Method Details

#send_message(params) ⇒ Object

Send message from GMAIL account via capybara!

Example:

params = {
  from:"[email protected]",
  pass:"testuser123",
  to:"[email protected]",
  theme:"test.theme",
  message:"test.message"
}
>> CapybaraSimpleEmailer.new.send_message(params)

Arguments:

params: (Hash)
  * required keys - from:, pass:, to:, theme:, message:


27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/capybara_simple_emailer.rb', line 27

def send_message(params)
  begin
    visit('/')
    fill_in 'Email', with: params[:from]
    find("#next").click
    fill_in 'Password', with: params[:pass]
    find("#signIn").click
    find('.T-I-KE.L3').click
    find('.GS textarea').set(params[:to])
    find('.aoT').set(params[:theme])
    find('.GP').click
    find('.Am.Al.editable').set(params[:message])
    find('.T-I-atl.L3').click
    return "Done"
  rescue
    return "Error"
  end
end