I ran [MacBook-Pro-10:~/apache/git/whimsy] clr% ruby tools/testmail.rb Date: Mon, 22 Jun 2020 19:40:56 -0700 From: Craig L Russell <c...@apache.org> To: Craig L Russell <apache....@gmail.com> Message-ID: <5ef16bb8f87f_15238258-...@macbook-pro-10.local.mail> Subject: test mail Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit
sent from MacBook-Pro-10.local with my ~/.whimsy: :sendmail: delivery_method: smtp address: smtp.gmail.com port: 587 domain: apache.org user_name: 'papa...@gmail.com' password: 'noyb' authentication: plain enable_starttls_auto: true I verified I can login to gmail with the password but I still get: Traceback (most recent call last): 8: from tools/testmail.rb:29:in `<main>' 7: from /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/message.rb:276:in `deliver!' 6: from /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!' 5: from /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session' 4: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:518:in `start' 3: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:565:in `do_start' 2: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:728:in `authenticate' 1: from /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:736:in `auth_plain' /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:975:in `check_auth_response': 535-5.7.8 Username and Password not accepted. Learn more at (Net::SMTPAuthenticationError) > On Jun 22, 2020, at 6:43 PM, Sam Ruby <ru...@intertwingly.net> wrote: > > On Mon, Jun 22, 2020 at 7:13 PM Craig Russell <apache....@gmail.com> wrote: >> >> What credentials do I need for the mail application? Testing locally, >> running in the infra/whimsy environment? > > See > https://github.com/apache/whimsy/blob/master/MACOSX.md#configure-sending-of-mail > > Getting this to work will require you to get ~/.whimsy file to work. > Previously you deleted/renamed that file so that you can make forward > progress. Now that you have a working system, hopefully you can > recreate that file and identify and address why it wasn't working for > you. > > Longer answer: mail requires things called a Mail Transfer Agent > (MTA). In the early days of the internet, wide open mail transfer > agents were overrun by spammers. Now MTAs implement some sort of > authentication. > > The MTA that services the ASF requires that email come from a > whitelisted machine. Generally when we spin up a new VM for whimsy we > have to ask the infra team to add the new VM to the whitelist. On > rare occasions, this has broken and we need to ask the infra team to > fix it. Taken together, I wrote a small test tool (mentioned in the > link above) to verify that sending of mail is possible. > > When testing locally, you will need to conform to what your local mail > server uses. In my case, I can use mail.twc.com as long as the email > is going out through my ISP provided modem. Or, as mentioned in the > link above, you can use gmail as the MTA as long as you have a valid > gmail user and password. You may have access to other MTAs. > > - Sam Ruby > >> mail = Mail.new do >> to "#{user.public_name}<#{user.mail.first}>" >> # cc "secret...@apache.org" >> from "#{user.mail.first}" >> subject "Conflict of Interest affirmation from #{user.public_name}" >> body "This year's Conflict of Interest affirmation is attached." >> end >> mail.attachments["#{user.id}.txt"] = affirmed >> mail.deliver! >> end >> >> #<Errno::ECONNREFUSED: Connection refused - connect(2) for "localhost" port >> 25> >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:539:in >> `initialize' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:539:in `open' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:539:in >> `tcp_socket' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:549:in `block in >> do_start' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/timeout.rb:95:in `block in >> timeout' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/timeout.rb:105:in `timeout' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:548:in `do_start' >> /usr/local/Cellar/ruby/2.7.1_2/lib/ruby/2.7.0/net/smtp.rb:518:in `start' >> >> /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in >> `start_smtp_session' >> >> /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in >> `deliver!' >> /usr/local/lib/ruby/gems/2.7.0/gems/mail-2.7.1/lib/mail/message.rb:276:in >> `deliver!' >> /srv/whimsy/www/officers/coi.cgi:177:in `block in emit_post' >> >> >>> On Jun 22, 2020, at 3:29 PM, Craig Russell <apache....@gmail.com> wrote: >>> >>> Another couple of questions: >>> >>> 1. What's the best way to --dryrun the commit until I have the rest of the >>> application working? I know there are a couple of ways to do it, from >>> putting --dryrun into some of the svn commands to using a keyboard entry to >>> do it. Is it <ctrl> click on the keyboard? >>> >>> 2. What's the best model for implementing the mailto: user, cc:secretary? >>> Is it as easy as require 'mail' and use a whimsy mail API? >>> >>> Thanks, >>> Craig >>> >>>> On Jun 22, 2020, at 3:23 PM, Sam Ruby <ru...@intertwingly.net> wrote: >>>> >>>> On Mon, Jun 22, 2020 at 5:20 PM Craig Russell <apache....@gmail.com> wrote: >>>>> >>>>> I've pushed a work in progress to branch coi. It currently does what I >>>>> want it to do for "get", which is to calculate who is required to affirm >>>>> the coi. >>>>> >>>>> But when I submit the "post" it gives an error >>>>> #<NameError: undefined local variable or method >>>>> `coi_current_template_url'> >>>>> /srv/whimsy/www/officers/coi.cgi:146:in `emit_post' >>>>> /srv/whimsy/www/officers/coi.cgi:130:in `block (5 levels) in <main>' >>>>> /srv/whimsy/www/officers/coi.cgi:128:in `block (4 levels) in <main>' >>>>> /Users/clr/apache/git/whimsy/lib/whimsy/asf/themes.rb:43:in `block (2 >>>>> levels) in _whimsy_panel' >>>>> >>>>> There is a variable coi_current_template_url but it is out of scope. >>>>> >>>>> Is there documentation/discussion of scoping rules for the whimsy cgi >>>>> environment? >>>>> >>>>> I've attached the coi.cgi in case it's easier to see what's gone wrong... >>>> >>>> Scoping rules in Ruby are a bit complicated. If these values aren't >>>> expected to be modified, the recommendation is to change the variable >>>> names to be ALL_CAPS. If the values are expected to be modified, >>>> prefix the variable name with a dollar sign ($). >>>> >>>>> Craig L Russell >>>>> c...@apache.org >>>> >>>> - Sam Ruby >>> >>> Craig L Russell >>> c...@apache.org >>> >> >> Craig L Russell >> c...@apache.org >> Craig L Russell c...@apache.org