python - ruby mail error, EACCES -
i tried send mail (ruby gem installed. gem install mail ). then, error. connect(2) eacces. mean?
in addition, send mail same destination (smtp.example.jp) in python, that's ok.
do know cause?
ruby code:
# coding: utf-8 require 'net/smtp' host = 'smtp.example.jp' port = 25 smtp = net::smtp.new(host, port) smtp.enable_starttls smtp.start( 'localhost', 'user@example.jp', 'password', :login ) |s| s.send_message "hoge", 'user@example.jp', 'user@example.jp' end smtp.finish error message
c:/ruby200/lib/ruby/2.0.0/net/smtp.rb:541:in `initialize': permission denied - connect(2) (errno::eacces) c:/ruby200/lib/ruby/2.0.0/net/smtp.rb:541:in `open' c:/ruby200/lib/ruby/2.0.0/net/smtp.rb:541:in `tcp_socket' c:/ruby200/lib/ruby/2.0.0/net/smtp.rb:551:in `block in do_start' c:/ruby200/lib/ruby/2.0.0/timeout.rb:66:in `timeout' c:/ruby200/lib/ruby/2.0.0/net/smtp.rb:550:in `do_start' c:/ruby200/lib/ruby/2.0.0/net/smtp.rb:520:in `start' smtp4.rb:10:in `<main>' ruby version
% ruby -v ruby 2.0.0p451 (2014-02-24) [i386-mingw32] python code. that's ok.
#!/usr/local/bin/python # -*- coding: utf-8 -*- import smtplib s = smtplib.smtp('smtp.example.jp', 25) s.login('user@example.jp', "password") s.sendmail('user@example.jp', 'user@example.jp', "hogehoge") s.close() python version
$ python --version python 2.5.1
Comments
Post a Comment