On Fri, Nov 27, 2020 at 02:39:52PM +0800, Liu Yinsi wrote:
use send-mail service to mail.
Signed-off-by: Liu Yinsi liuyinsi@163.com
user-client/maintain/walk-os-test/walk-os-iperf-test | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/user-client/maintain/walk-os-test/walk-os-iperf-test b/user-client/maintain/walk-os-test/walk-os-iperf-test index 7ed07c5..f65959d 100755 --- a/user-client/maintain/walk-os-test/walk-os-iperf-test +++ b/user-client/maintain/walk-os-test/walk-os-iperf-test @@ -34,6 +34,16 @@ OS_MOUNT = %w[cifs initramfs].freeze
EMAIL_ADDRESS = (ENV['USER']).to_s.freeze
+def send_mail
- message = File.read(LOG).chomp
- data = "
- subject: os rootfs test report
- to: #{EMAIL_ADDRESS}
- body: '#{message}'"
- %x(curl -X POST 'localhost:11311/send_mail_yaml' -d "#{data}")
11311 => LOCAL_SEND_MAIL_PORT
May be you can use mail_client.rb in lib.
Thanks, Xueliang
+end
def write_report(report_all) file = File.open(LOG, 'a') log = Logger.new(file, 'weekly') -- 2.23.0