たとえば、 Ruby でこんなコードを書いてメールを送信したいとする。 require 'mail' options = { address: 'smtp.gmail.com', port: 587, domain: 'gmail.com', user_name: USER_NAME, password: PASSWORD, authentication: 'plain', enable_starttls_auto: true } Mail.defaults do delivery_method :smtp, options end mail = Mail.new do to 'karuran.f@gmail.com' from 'karuran@gmail.com' subject 'test ' html_part do content_type 'text/html; charset
![Gmail を使って Net::SMTPAuthenticationError が出力される場合の解決法 - 大学生からの Web 開発](https://cdn-ak-scissors.b.st-hatena.com/image/square/b991743378e705c818be39551b39073073c2cb38/height=288;version=1;width=512/http%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Fk%2Fkarur4n%2F20150307%2F20150307232612.png)