I want to send an email from my ruby script using Pony mail. When I set it up for gmail smtp it works fine. When I set it up to use our ISP's SMPT I get this error.
I was told by iiNet representative that no authentication is needed. When I send email from command line using mail command it works nicely. Or even when sending email using telnet mail.iinet.com.au 25 no authentication is required.
/usr/lib64/ruby/1.8/net/smtp.rb:777:in check_auth_args': SMTP-AUTH requested but missing secret phrase (ArgumentError)
for settings
  Pony.mail(:to => '[email protected]', 
        :from => '[email protected]',
            :subject => 'overnight testing results', 
            :body => results, 
            :via => :smtp, 
            :via_options => {
               #:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
               :address     => 'mail.iinet.com.au',
               :port     => '25',
               #:enable_starttls_auto => true,
               #:user_name     => '[email protected]',
               #:password => '1234',
               :authentication     => :plain,           # :plain, :login, :cram_md5, no auth by default
                :domain               => "localhost.localdomain" # the HELO domain provided by the client to the server
                                                     }
) 
if I do telnet mail.iinet.com.au 25 with below commands the email is sent and received. No authentication required.
mail from: from@address
rcpt to: to@address
data
from: from@address
to: to@address
subject: subject line
message body
.
You are specifying that you want to perform authentication.  Remove the line that says :authentication => :plain
This works like a charm for me:
require 'pony'
Pony.mail(
  :to => 'xxx', 
  :from => 'xxx',
  :subject => 'test', 
  :body => "test", 
  :via => :smtp, 
  :via_options => {
      :address     => 'xxx',
      :port     => '25',
    }
)
obviously you need to replace these "xxx" with real values
I posted a question to ponyrb group and the solution is to use enable_starttls_auto => false
so the final working code for me is
Pony.mail(
  :to => '[email protected]', 
  :from => '[email protected]',
  :subject => 'test', 
  :body => "test pony", 
  :via => :smtp, 
  :via_options => {
      :address     => 'mail.iinet.com.au',
      :port     => '25',
      :enable_starttls_auto => false
    }
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With