Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How I can disable log message in stderr? #92

Open
tit opened this issue Jul 21, 2017 · 0 comments
Open

How I can disable log message in stderr? #92

tit opened this issue Jul 21, 2017 · 0 comments

Comments

@tit
Copy link

tit commented Jul 21, 2017

I try send email

$ irb -r gmail
2.3.1 :001 > gmail = Gmail.new 'vezetvsem.test', password
2.3.1 :002 > gmail.deliver do
2.3.1 :003 >   from '[email protected]'
2.3.1 :004?>  to '[email protected]'
2.3.1 :005?>  subject 'test'
2.3.1 :006?>  body 'test'
2.3.1 :007?> end

First problem

/Users/tit/.rvm/gems/ruby-2.3.1/gems/ruby-gmail-0.3.1/lib/smtp_tls.rb:39:in `do_tls_start': Object#timeout is deprecated, use Timeout.timeout instead.

Please, fix it, if you can.

Second problem

-> "220 smtp.gmail.com ESMTP 21sm822378ljv.67 - gsmtp\r\n"
<- "EHLO vezetvsem.test\r\n"
-> "250-smtp.gmail.com at your service, [178.76.226.8]\r\n"
-> "250-SIZE 35882577\r\n"
-> "250-8BITMIME\r\n"
-> "250-STARTTLS\r\n"
-> "250-ENHANCEDSTATUSCODES\r\n"
-> "250-PIPELINING\r\n"
-> "250-CHUNKING\r\n"
-> "250 SMTPUTF8\r\n"
<- "STARTTLS\r\n"
-> "220 2.0.0 Ready to start TLS\r\n"
<- "EHLO vezetvsem.test\r\n"
-> "250-smtp.gmail.com at your service, [178.76.226.8]\r\n"
-> "250-SIZE 35882577\r\n"
-> "250-8BITMIME\r\n"
-> "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n"
-> "250-ENHANCEDSTATUSCODES\r\n"
-> "250-PIPELINING\r\n"
-> "250-CHUNKING\r\n"
-> "250 SMTPUTF8\r\n"
<- "AUTH PLAIN AHZlemV0dnNlbS50ZXN0QGdtYWlsLmNvbQBzMjE0UzIxNA==\r\n"
-> "235 2.7.0 Accepted\r\n"
<- "MAIL FROM:<[email protected]>\r\n"
-> "250 2.1.0 OK 21sm822378ljv.67 - gsmtp\r\n"
<- "RCPT TO:<[email protected]>\r\n"
-> "250 2.1.5 OK 21sm822378ljv.67 - gsmtp\r\n"
<- "DATA\r\n"
-> "354  Go ahead 21sm822378ljv.67 - gsmtp\r\n"
writing message from String
wrote 288 bytes
-> "250 2.0.0 OK 1500626420 21sm822378ljv.67 - gsmtp\r\n"
<- "QUIT\r\n"
-> "221 2.0.0 closing connection 21sm822378ljv.67 - gsmtp\r\n"

Every time gmail gem write in stderr this log.
If I run my script with this gem in cron, I have recived error mail from cron with this log.
I solved this problem for next code. Before use send email by gmail gem I:

stderr = File.new '/dev/null', 'w'
$stderr.reopen stderr

Please, add optional parameter to gem, ex. debug: false.

Sorry for my bad english...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant