配置文件时按照官方来写的,应该不太可能有问题,下面是在控制台测试打印的数据,最后直接自动退出控制台,请懂的人帮忙看一下O(∩_∩)O谢谢
root@demo:/etc/gitlab# gitlab-rails console -e production
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 13.9.4 (4be21b77456) FOSS
GitLab Shell: 13.17.0
PostgreSQL: 12.5
--------------------------------------------------------------------------------
Loading production environment (Rails 6.0.3.4)
irb(main):001:0> Notify.test_email('user@demo.com.cn','title','body').deliver_now
Notify#test_email: processed outbound mail in 1.1ms
Delivered mail 61409743a0853_622554d83290@demo.mail (65.3ms)
Date: Tue, 14 Sep 2021 20:36:19 +0800
From: infivision <git@infivision.com.cn>
Reply-To: demo <noreply@www.demo.com.cn>
To: user@demo.com.cn
Message-ID: <61409743a0853_622554d83290@demo.mail>
Subject: title
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>body</p></body></html>
Traceback (most recent call last):
1: from (irb):1
Traceback (most recent call last):
26: from bin/rails:4:in `<main>'
25: from bin/rails:4:in `require'
24: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands.rb:18:in `<top (required)>'
23: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/command.rb:46:in `invoke'
22: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/command/base.rb:69:in `perform'
21: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
20: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
19: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
18: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/console/console_command.rb:102:in `perform'
17: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/console/console_command.rb:19:in `start'
16: from /opt/gitlab/embedded/lib/ruby/gems/2.7.0/gems/railties-6.0.3.4/lib/rails/commands/console/console_command.rb:70:in `start'
15: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:400:in `start'
14: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:471:in `run'
13: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:471:in `catch'
12: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:472:in `block in run'
11: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:537:in `eval_input'
10: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `each_top_level_statement'
9: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `catch'
8: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `block in each_top_level_statement'
7: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `loop'
6: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb/ruby-lex.rb:166:in `block (2 levels) in each_top_level_statement'
5: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:538:in `block in eval_input'
4: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:704:in `signal_status'
3: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:559:in `block (2 levels) in eval_input'
2: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:608:in `handle_exception'
1: from /opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:608:in `print'
/opt/gitlab/embedded/lib/ruby/2.7.0/irb.rb:608:in `write': "\\xC7" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)