开发者

sending an email via Pony mail with no authentication?

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(开发者_StackOverflow中文版:to => 'radek@edume.com.au', 
        :from => 'radek@edu.com.au',
            :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     => 'qwer@mail.iinet.com.au',
               #: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
                                                     }
) 

conf

  • ruby 1.8.7 (2010-01-10 patchlevel (249) [x86_64-linux]
  • mail (2.3.0)
  • mime-types (1.16)
  • pony (1.2)

update I

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 => 'radek@edu.com.au', 
  :from => 'radek@edu.com.au',
  :subject => 'test', 
  :body => "test pony", 
  :via => :smtp, 
  :via_options => {
      :address     => 'mail.iinet.com.au',
      :port     => '25',
      :enable_starttls_auto => false
    }
)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜