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

Detailed SMTP setup #6759

Merged
merged 3 commits into from Mar 12, 2018
Jump to file or symbol
Failed to load files and symbols.
+37 −16
Diff settings

Always

Just for now

View
@@ -224,24 +224,43 @@ namespace :mastodon do
prompt.say "\n"
loop do
env['SMTP_SERVER'] = prompt.ask('SMTP server:') do |q|
q.required true
q.default 'smtp.mailgun.org'
q.modify :strip
end
if prompt.yes?('Do you want to send e-mails from localhost?', default: false)
env['SMTP_SERVER'] = 'localhost'
env['SMTP_PORT'] = 25
env['SMTP_AUTH_METHOD'] = 'none'
env['SMTP_OPENSSL_VERIFY_MODE'] = 'none'
else
env['SMTP_SERVER'] = prompt.ask('SMTP server:') do |q|
q.required true
q.default 'smtp.mailgun.org'
q.modify :strip
end
env['SMTP_PORT'] = prompt.ask('SMTP port:') do |q|
q.required true
q.default 587
q.convert :int
end
env['SMTP_PORT'] = prompt.ask('SMTP port:') do |q|
q.required true
q.default 587
q.convert :int
end
env['SMTP_LOGIN'] = prompt.ask('SMTP username:') do |q|
q.modify :strip
end
env['SMTP_LOGIN'] = prompt.ask('SMTP username:') do |q|
q.modify :strip
end
env['SMTP_PASSWORD'] = prompt.ask('SMTP password:') do |q|
q.echo false
env['SMTP_PASSWORD'] = prompt.ask('SMTP password:') do |q|
q.echo false
end
env['SMTP_AUTH_METHOD'] = prompt.ask('SMTP authentication:') do |q|
q.required
q.default 'plain'
q.modify :strip
end
env['SMTP_OPENSSL_VERIFY_MODE'] = prompt.ask('SMTP OpenSSL verify mode:') do |q|
q.required
q.default 'peer'
q.modify :strip
end
end
env['SMTP_FROM_ADDRESS'] = prompt.ask('E-mail address to send e-mails "from":') do |q|
@@ -261,7 +280,8 @@ namespace :mastodon do
:user_name => env['SMTP_LOGIN'].presence,
:password => env['SMTP_PASSWORD'].presence,
:domain => env['LOCAL_DOMAIN'],
:authentication => :plain,
:authentication => env['SMTP_AUTH_METHOD'] == 'none' ? nil : env['SMTP_AUTH_METHOD'] || :plain,
:openssl_verify_mode => env['SMTP_OPENSSL_VERIFY_MODE'],
:enable_starttls_auto => true,
}
@@ -271,6 +291,7 @@ namespace :mastodon do
mail = ActionMailer::Base.new.mail to: send_to, subject: 'Test', body: 'Mastodon SMTP configuration works!'
mail.deliver
break
rescue StandardError => e
prompt.error 'E-mail could not be sent with this configuration, try again.'
prompt.error e.message
ProTip! Use n and p to navigate between commits in a pull request.