Unable to implement the correct way to use Pony

182 views
Skip to first unread message

Sam D.

unread,
Aug 12, 2013, 11:45:45 AM8/12/13
to pon...@googlegroups.com
Hi Ben,

I just found the express way to send emails using Pony in 1 line and thus, tried using it the following way: The test passed with no error but didn't receive any eI'm using mail

describe 'Test Example'
  it 'sends email' do
       Pony.mail(:from => 'thisisbeautiful..@gmail.com', :to =>  'thisisbeautiful..@gmail.com', :via => :sendmail, :subject => 'hi', :body => 'hello world')
  end
end

And, the test fails on using :via => smtp, giving any error : "Errno::ECONNREFUSED: Connection refused - connect(2)"

I'm using Rubymine IDE with RSpec (2.0.5) framework on Mac OS X Mountain Lion. 
My Ruby version is 2.0.0

Can you please suggest if I'm missing some steps to use Pony?

Thanks
Sam

Ben Prew

unread,
Aug 12, 2013, 2:35:56 PM8/12/13
to pon...@googlegroups.com
Sam,

You probably have to use gmail's smtp servers, not your local machine.  Something like this:
Pony.mail({
  :to => 'y...@example.com',
  :via => :smtp,
  :via_options => {
    :address              => 'smtp.gmail.com',
    :port                 => '587',
    :enable_starttls_auto => true,
    :user_name            => 'user',
    :password             => 'password',
    :authentication       => :plain, # :plain, :login, :cram_md5, no auth by default
    :domain               => "localhost.localdomain" # the HELO domain provided by the client to the server
  }
})


--
 
---
You received this message because you are subscribed to the Google Groups "Ponyrb" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ponyrb+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sam D.

unread,
Aug 13, 2013, 9:28:19 AM8/13/13
to pon...@googlegroups.com, b...@throwingbones.com
ok, thanks Ben.

Please also confirm  - what should be the value for fields user_name/password and domain?


On Monday, August 12, 2013 2:35:56 PM UTC-4, Ben Prew wrote:
Sam,

You probably have to use gmail's smtp servers, not your local machine.  Something like this:
Pony.mail({
  :to => 'y...@example.com',
  :via => :smtp,
  :via_options => {
    :address              => 'smtp.gmail.com',
    :port                 => '587',
    :enable_starttls_auto => true,
    :user_name            => 'user',
    :password             => 'password',
    :authentication       => :plain, # :plain, :login, :cram_md5, no auth by default
    :domain               => "localhost.localdomain" # the HELO domain provided by the client to the server
  }
})
On Mon, Aug 12, 2013 at 8:45 AM, Sam D. <thisisbeau...@gmail.com> wrote:
Hi Ben,

I just found the express way to send emails using Pony in 1 line and thus, tried using it the following way: The test passed with no error but didn't receive any eI'm using mail

describe 'Test Example'
  it 'sends email' do
       Pony.mail(:from => 'thisisbe...@gmail.com', :to =>  'thisisbe...@gmail.com', :via => :sendmail, :subject => 'hi', :body => 'hello world')
  end
end

And, the test fails on using :via => smtp, giving any error : "Errno::ECONNREFUSED: Connection refused - connect(2)"

I'm using Rubymine IDE with RSpec (2.0.5) framework on Mac OS X Mountain Lion. 
My Ruby version is 2.0.0

Can you please suggest if I'm missing some steps to use Pony?

Thanks
Sam

Ben Prew

unread,
Aug 13, 2013, 9:59:12 AM8/13/13
to pon...@googlegroups.com
Sam,

The username/password will be your gmail username and password.  The domain will be the name the pony sending server would be identified as.
Reply all
Reply to author
Forward
0 new messages