美文网首页开发工具癖程序员
水银小技巧-向服务器推送时给群组成员发送邮件

水银小技巧-向服务器推送时给群组成员发送邮件

作者: 行之与亦安 | 来源:发表于2016-09-28 10:56 被阅读85次

之前翻译过一系列文章,探讨水银的使用方法

进来由于工作原因,使用了 bitbucket代码托管网站。这个网站是为数不多的支持水银的代码托管网站之一。经过尝试,感觉真心不错。里面有这么一个Service功能,可以添加各种各样的服务。其中有一个服务,叫做Email。这个服务可以在有人给这个仓库push代码的时候,发送邮件给这个仓库的订阅者。

这的确是一个比较使用的功能。大家也不可能实时关注仓库的动态,能够有这种通知来提醒大家是再好不过了。那么,如果不用bitbucket的话,可不可以也有这个功能呢?通过尝试,发现这个功能可以有。

我在Windows 7和Ubuntu上都尝试了这个功能,其实实现起来是一模一样的。我们要做的,只是编辑一个文件。这个文件是你仓库下的.hg下的hgrc文件。当然,这也不是我发明的,网上有教程,只是一开始我摸索了好久都没成功,后来也是糊里糊涂地就搞定了。

[extensions]
notify=

[hooks]
# Enable either changegroup or incoming or outgoing.
# changegroup will send one email for all incoming changesets,
# whereas incoming sends one email per incoming changeset.
# Note: Configuring both is possible, but probably not
#       what you want, you'll get one email for the group
#       and one for each changeset in the group.
# outgoing will send one email for all outgoing changesets
changegroup.notify = python:hgext.notify.hook
#incoming.notify = python:hgext.notify.hook
#outgoing.notify = python:hgext.notify.hook
[email]
from = ZhongCheng<zhongcheng0519@163.com>
method = smtp

[smtp]
host = smtp.163.com
# Optional options:
username = *******@163.com
password = *******
port = 25
# tls = smtps
tls = none
# local_hostname = me.example.com

# the baseurl is used for constructing hgweb-URLs for the mails
# It can be a dummy value if your repo isn't
# available via http
[web]
baseurl = http://hgserver/hg

[notify]
# Space separated list of change sources. Notifications are sent only
# if it includes the incoming or outgoing changes source. Incoming
# sources can be ``serve`` for changes coming from http or ssh,
# ``pull`` for pulled changes, ``unbundle`` for changes added by
# :hg:`unbundle` or ``push`` for changes being pushed
# locally. Outgoing sources are the same except for ``unbundle`` which
# is replaced by ``bundle``. Default: serve.
sources = serve push unbundle

# set this to False when you're ready for mail to start sending
test = False

# While the subscription information can be included in this file,
#   (in which case, set: config =)
# having it in a separate file allows for it to be version controlled
# and for the option of having subscribers maintain it themselves.
# config = 

[reposubs]
# key is glob pattern, value is comma-separated list of subscriber emails
* = *******@163.com,*******@163.com,**********@qq.com

# You can override the changeset template here, if you want.
# If it doesn't start with \n it may confuse the email parser.
# here's an example that makes the changeset template look more like hg log:
template =
  details:   {baseurl}/{webroot}/rev/{node|short}
  branches:  {branches}
  changeset: {rev}:{node|short}
  user:      {author}
  date:      {date|date}
  description:
  {desc}\n

# max lines of diffs to include (0=none, -1=all)
maxdiff = 300

# if you want to use a shorter repo-name, you can strip off components at the beginning.
# For example to strip off /usr/local/hg/repos from /usr/local/hg/repos/code use
# strip = 5

我这里使用的是163的smtp服务器,当然,技术好的可以自己搭一个。另外,qq的smtp服务器貌似不太好用,Gmail的smtp的端口号是587。

相关文章

  • 水银小技巧-向服务器推送时给群组成员发送邮件

    之前翻译过一系列文章,探讨水银的使用方法。 进来由于工作原因,使用了 bitbucket代码托管网站。这个网站是...

  • Python入门系列--邮件--day02

    参考地址: Python发送邮件给多人 Python邮件功能 - 使用163邮箱SMTP服务器发送邮件

  • APNS推送原理

    1、由APP向iOS设备发送一个注册通知,用户需要同意后向系统发送推送。 2、iOS向APNS远程推送服务器发送A...

  • iOS推送原理

    1.由App向iOS设备发送一个注册通知,用户需要同意系统发送推送。2.iOS向APNs远程推送服务器发送App的...

  • 移动端 推送的测试

    iOS:无论app是否在进程 都会收到推送 原因:向app发送推送 走苹果自身的服务器 消息通道 再给client...

  • iOS面试题5

    1.远程推送原理是什么?? 由App向iOS设备发送一个注册通知 iOS向APNs远程推送服务器发送App的Bun...

  • Linux 《系统安装及配置邮件服务器》实验报告

    邮件服务器与DNS之间的关系 当发件方需要发送邮件给对方邮件服务器,需要向 DNS 请求查询对方邮件服务器的 MX...

  • 二. 网络应用-Internet电子邮件

    邮件系统结构 邮件服务器:电子邮件体系结构的核心功能: 发送和接收邮件; 向发信人报告邮件传送情况(已交付、被拒...

  • 推送(本地推送/远程推送)

    本地推送的步骤: 远程推送的步骤: 1、向苹果服务器发送请求,请求获取deviceToken. 2、得到苹果返回的...

  • ios .p12证书生成pem文件

    1、pem文件概述 pem文件是服务器向苹果服务器做推送时候需要的文件,主要是给php向苹果服务器验证时使用,...

网友评论

    本文标题:水银小技巧-向服务器推送时给群组成员发送邮件

    本文链接:https://www.haomeiwen.com/subject/dvmhyttx.html