Signed-off-by: Luan Shengde luanshengde2@huawei.com --- container/send-internet-mail/start | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 container/send-internet-mail/start
diff --git a/container/send-internet-mail/start b/container/send-internet-mail/start new file mode 100755 index 0000000..e4d641d --- /dev/null +++ b/container/send-internet-mail/start @@ -0,0 +1,72 @@ +#!/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 'set' +require_relative '../defconfig' + +docker_rm 'send-internet-mail' + +names = Set.new %w[ + EMAIL_PASSWORD + EMAIL_ADDRESS +] + +defaults = relevant_defaults(names) + +EMAIL_ADDRESS = defaults['EMAIL_ADDRESS'] +EMAIL_PASSWORD = defaults['EMAIL_PASSWORD'] + +cmd = %W[ + docker run + --restart=always + --name=send-internet-mail + -d + -e EMAIL_ADDRESS=#{EMAIL_ADDRESS} + -e EMAIL_PASSWORD=#{EMAIL_PASSWORD} + -e CCI_SRC=#{ENV['CCI_SRC']} + -p 11312:11312 + -v #{ENV['CCI_SRC']}:#{ENV['CCI_SRC']} + -v /etc/localtime:/etc/localtime:ro + --log-driver json-file + send-internet-mail +] + +cmd += ['bash', '-c', "#{ENV['CCI_SRC']}/lib/mail-post.rb"] + +system(*cmd) + + +puts <<EOF +port: +--- +data='{ +"subject": "email subject", +"to": "email_to_addr", +"body": "email message" +}' + +or + +data=" +subject: email subject +to: email_to_addr +body: email message" + +Usage: + curl -XPOST 'send-mail-server:11312/send_mail_yaml' -d "$data" + +--- +data=" +To: email_to_addr +Subject: email_subject + +mail_msg_line1 +mail_msg_line2 +... +" + +Usage: + curl -XPOST 'send-mail-server:11312/send_mail_text' -d "$data" +EOF
On Tue, Oct 20, 2020 at 04:39:38PM +0800, Luan Shengde wrote:
Signed-off-by: Luan Shengde luanshengde2@huawei.com
container/send-internet-mail/start | 72 ++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 container/send-internet-mail/start
diff --git a/container/send-internet-mail/start b/container/send-internet-mail/start new file mode 100755 index 0000000..e4d641d --- /dev/null +++ b/container/send-internet-mail/start @@ -0,0 +1,72 @@ +#!/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 'set' +require_relative '../defconfig'
+docker_rm 'send-internet-mail'
+names = Set.new %w[
- EMAIL_PASSWORD
- EMAIL_ADDRESS
+]
This blankline can be deleted.
+defaults = relevant_defaults(names)
ditto.
+EMAIL_ADDRESS = defaults['EMAIL_ADDRESS'] +EMAIL_PASSWORD = defaults['EMAIL_PASSWORD']
+cmd = %W[
- docker run
- --restart=always
- --name=send-internet-mail
- -d
- -e EMAIL_ADDRESS=#{EMAIL_ADDRESS}
- -e EMAIL_PASSWORD=#{EMAIL_PASSWORD}
- -e CCI_SRC=#{ENV['CCI_SRC']}
- -p 11312:11312
- -v #{ENV['CCI_SRC']}:#{ENV['CCI_SRC']}
- -v /etc/localtime:/etc/localtime:ro
- --log-driver json-file
- send-internet-mail
Is this docker image made by yourself, if so, how about push it into local dockerhub.
Thanks, Xijian