[PATCH v4 compass-ci 2/6] container/send-internet-mail: internet-smtp.rb

setup smtp for email server Signed-off-by: Luan Shengde <luanshengde2@huawei.com> --- lib/internet-smtp.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 lib/internet-smtp.rb diff --git a/lib/internet-smtp.rb b/lib/internet-smtp.rb new file mode 100644 index 0000000..3f181ba --- /dev/null +++ b/lib/internet-smtp.rb @@ -0,0 +1,20 @@ +#!/usr/bin/env ruby +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. +# frozen_string_literal: true + +require 'mail' + +def setup_smtp + smtp = { + address: 'smtp.qq.com', + port: 25, + domain: 'qq.com', + user_name: ENV['ROBOT_EMAIL_ADDRESS'], + password: ENV['ROBOT_EMAIL_PASSWORD'], + openssl_verify_mode: 'none', + enable_starttls_auto: true + } + + Mail.defaults { delivery_method :smtp, smtp } +end -- 2.23.0

On Wed, Oct 21, 2020 at 09:56:10AM +0800, Wu Fengguang wrote:
On Wed, Oct 21, 2020 at 09:27:56AM +0800, Luan Shengde wrote:
setup smtp for email server
Signed-off-by: Luan Shengde <luanshengde2@huawei.com> --- lib/internet-smtp.rb | 20 ++++++++++++++++++++
Please move to container/send-internet-mail/
Perhaps also fine here. Not a big problem. Thanks, Fengguang
participants (2)
-
Luan Shengde
-
Wu Fengguang