From 982342e98e768e5043d6f41735c156a71e3a4490 Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Thu, 23 Jul 2020 01:33:48 +0800 Subject: [PATCH 01/13] Update 20190808 Sending custom emails with Python.md --- ...90808 Sending custom emails with Python.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md index 7ba7b6da60..7284c3cd74 100644 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -7,37 +7,36 @@ [#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) [#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) -Sending custom emails with Python +使用Python发送定制邮件 ====== -Customize your group emails with Mailmerge, a command-line program that -can handle simple and complex emails. +Mailmerge是一个可以处理简单邮件和复杂邮件的命令行程序,可以用它定制组邮件。 ![Chat via email][1] -Email remains a fact of life. Despite all its warts, it's still the best way to send information to most people, especially in automated ways that allow messages to queue for recipients. +电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在以自动化方式实现受众信息队列的场景。 -One of the highlights of my work as the [Fedora Community Action and Impact Coordinator][2] is giving people good news about travel funding. I often send this information over email. Here, I'll show you how I send custom messages to groups of people using [Mailmerge][3], a command-line Python program that can handle simple and complex emails. +我作为[Fedora社区行动和影响协调员 ][2]的工作之一就是给人们发送旅行基金相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用[Mailmerge][3],一个可以处理简单邮件及复杂邮件的命令行程序,向一组人发送定制信息。 -### Install Mailmerge +### 安装 Mailmerge -Mailmerge is packaged and available in Fedora, and you can install it from the command line with **sudo dnf install python3-mailmerge**. You can also install it from PyPI using **pip**, as the project's [README explains][4]. +在Fedora中,Mailmerge已经打包可用,你可以通过在命令行中运行**sudo dnf install python3-mailmerge**来安装它。你还可以使用**pip**命令从PyPi中安装,具体可以参阅该项目的[说明][4]。 -### Configure your Mailmerge files +### 配置 Mailmerge -Three files control how Mailmerge works. If you run **mailmerge --sample**, it will create template files for you. The files are: +三个配置文件控制着Mailmerge的工作模式。运行**mailmerge --sample**,将生成配置文件模板。这些文件包括: - * **mailmerge_server.conf:** This contains the configuration details for your SMTP host to send emails. Your password is _not_ stored in this file. - * **mailmerge_database.csv:** This holds the custom data for each email, including the recipients' email addresses. - * **mailmerge_template.txt:** This is your email's text with placeholder fields that will be replaced using the data from **mailmerge_database.csv**. + * **mailmerge_server.conf:** 这里保存着SMTP服务端邮件发送相关详细配置,但你的密码 _不_ 在这里保存。 + * **mailmerge_database.csv:** 这里保存每封邮件的个性数据,包括收件人电子邮件地址。 + * **mailmerge_template.txt:** 这里保存电子邮件的文本,文本中包含占位符,这些占位符会使用**mailmerge_database.csv**中的数据替换。 #### Server.conf -The sample **mailmerge_server.conf** file includes several examples that should be familiar. If you've ever added email to your phone or set up a desktop email client, you've seen this data before. The big thing to remember is to update your username in the file, especially if you are using one of the example configurations. +配置模板文件**mailmerge_server.conf**包含几个大家应该很熟悉的例子。如果你曾经往手机上添加过电子邮件或者设置过桌面电子邮件客户端,那你就应该看到过这些数据。需要提醒的是要记得把你的用户名更新到这个文件中,尤其是在你使用模板所提供的配置时。 #### Database.csv -The **mailmerge_database.csv** file is a bit more complicated. It must contain (at minimum) the recipients' email addresses and any other custom details necessary to replace the fields in your email. It is a good idea to write the **mailmerge_template.txt** file at the same time you create the fields list for this file. I find it helpful to use a spreadsheet to capture this data and export it as a CSV file when I am done. This sample file: +**mailmerge_database.csv**这个配置文件稍微有点复杂。最起码要将邮件接收者的电子邮件地址保存在这里,其它在电子邮件中任何需要替换的定制信息也要保存在这里。推荐在创建本文件的占位符列表时,同步步编辑**mailmerge_template.txt**文件。我发现一个有效的做法是,使用电子表格软件录入这些数据,完成后导出为CSV文件。使用下面的示例文件: ``` @@ -46,9 +45,9 @@ email,name,number [bob@bobdomain.com][6],"Bob",42 ``` -allows you to send emails to two people, using their first name and telling them a number. This file, while not terribly interesting, illustrates an important habit: Always make yourself the first recipient in the file. This enables you to send yourself a test email to verify everything works as expected before you email the entire list. +你可以使用他们的名字,给这两个人发送邮件,并各告诉他们一个数字。这个示例文件虽然不是特别有趣,但应用了一个重要的原则,那就是:始终让自己处于邮件接收列表的首位。这样你可以在向列表全员发送邮件之前,先给自己发送一个测试邮件,以验证邮件的效果是否如你预期。 -If any of your values contain commas, you _**must**_ enclose the entire value in double-quotes (**"**). If you need to include a double-quote in a double-quoted field, use two double-quotes in a row. Quoting rules are fun, so read about [CSVs in Python 3][7] for specifics. +任何包含半角逗号的值,都 _**必须**_ 以半角双引号(**"**)封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中使用两个半角双引号。引用的定义规则比较有趣,去[Python3中的CSV][7]一探究竟吧。 #### Template.txt @@ -221,13 +220,13 @@ Also note that I extended the database with two fields, **Hotel** and **File**. Doing a dry-run and sending the emails is the same whether you're using a simple or a complex template. Give it a try! -You can also experiment with using conditionals (**if** … **endif**) in the header. You can, for example, have an attachment only if one is in the database, or maybe you need to change the sender's name for some emails but not others. +你还可以尝试在邮件头中使用条件判断(**if** … **endif**). You can, for example, have an attachment only if one is in the database, or maybe you need to change the sender's name for some emails but not others. -### Mailmerge's advantages +### Mailmerge的优点 -The Mailmerge program provides a powerful but simple method of sending lots of customized emails. Everyone gets only the information they need, and extraneous steps and details are omitted. +Mailmerge是用来批量发送个性化邮件的简洁而高效的工具。每个人只接受到他需要的信息,其它额外的操作和细节都是透明的。 -Even for simple group emails, I have found this method much more effective than sending one email to a bunch of people using CC or BCC. A lot of people filter their email and delay reading anything not sent directly to them. Using Mailmerge ensures that every person gets their own email. Messages will filter properly for the recipient and no one can accidentally "reply all" to the entire group. +我还发现,即使是在发送简单的集团邮件时,相对于使用CC或者BCC向一组受众发送一封邮件,采用Mailmerge也是非常高效的。很多人使用了邮件过滤,那些不是直接发给他们的邮件,他们一律不会立刻处理。使用Mailmerge保证了每名受众接收到的就是自己的邮件。所有的信息会对接收者进行正确过滤,再也不会有人无意间回复到整个邮件组。 -------------------------------------------------------------------------------- @@ -235,7 +234,7 @@ via: https://opensource.com/article/19/8/sending-custom-emails-python 作者:[Brian "bex" Exelbierd][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[silentdawn-zz](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From ad65859389c7425ea5c97a9843ba0d9e8286f3f3 Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Thu, 23 Jul 2020 11:50:24 +0800 Subject: [PATCH 02/13] Update 20190808 Sending custom emails with Python.md --- ...90808 Sending custom emails with Python.md | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md index 7284c3cd74..f46105b0b8 100644 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -51,7 +51,7 @@ email,name,number #### Template.txt -As part of my work, I get to share news about travel-funding decisions for our Fedora contributor conference, [Flock][8]. A simple email tells people they've been selected for travel funding and their specific funding details. One user-specific detail is how much money we can allocate for their airfare. Here is an abbreviated version of my template file (I've snipped out a lot of the text for brevity): +我的工作之一,就是向Fedora贡献者协会发送与旅行基金有关的信息,[Flock][8]。通过简单的邮件告诉有关的人,他被选中为旅行基金支持的幸运者,以及相应基金支持的详细信息。与接收者相关的具体信息之一就是我们可以为他的旅行提供多少资助。下面是一份我的节略后的模板文件(为了简洁,已经移除大量的文本): ``` @@ -69,7 +69,7 @@ Travel Budget: {{Travel_Budget}} <<snip>> ``` -The top of the template specifies the recipient, sender, and subject. After the blank line, there's the body of the email. This email needs the recipients' **Email**, **Name**, and **Travel_Budget** from the **database.csv** file. Notice that those fields are surrounded by double curly braces (**{{** and **}}**). The corresponding **mailmerge_database.csv** looks like this: +模板的起头定义了邮件的接收者、发送者和主题。在空行之后,是邮件的内容。该邮件需要从**database.csv**文件中获取接收者的**Email**、**Name**和**Travel_Budget**。注意,上述这些占位符是由双大括弧(**{{** **}}**)封闭的。相应的**mailmerge_database.csv**如下: ``` @@ -80,15 +80,15 @@ PersonA,[persona@fedoraproject.org][10],1500 PèrsonB,[personb@fedoraproject.org][11],500 ``` -Notice that I listed myself first (for testing) and there are two other people in the file. The second person, PèrsonB, has an accented character in their name; Mailmerge will automatically encode it. +注意,我把自己放在了第一个,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人PèrsonB,他的名字中有一个包含变音符号的字母,Mailmerge会对这类字母自动编码。 -That's the whole template concept: Write your email and put placeholders in double curly braces. Then create a database that provides those values. Now let's test the email. +以上包含了模板的全部知识点:写上你自己的电子邮件信息,并编写好以双大括弧封闭的占位符。接下来创建用来提供前述占位符具体值的数据文件。现在测试一下电子邮件的效果。 -### Test and send simple email merges +### 测试并发送简单邮件 -#### Do a dry-run +#### 试运行 -Start by doing a dry-run that prints the emails, with the placeholder fields completed, to the screen. By default, if you run the command **mailmerge**, it will do a dry-run of the first email: +测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令**mailmerge**,它将对收件列表中的第一个人进行试运行: ``` @@ -117,7 +117,7 @@ Travel Budget: 1000 >>> This was a dry run.  To send messages, use the --no-dry-run option. ``` -Reviewing the first email (**message 0**, as counting starts from zero, like many things in computer science), you can see my name and travel budget are correct. If you want to review every email, enter **mailmerge --no-limit** to tell Mailmerge not to limit itself to the first email. Here's the dry-run of the third email, which shows the special character encoding: +从试运行生成的邮件中(**第0条信息**,和计算机中很多计数场景一样,计数从0开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行**mailmerge --no-limit**,告诉Mailmerge不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: ``` @@ -133,11 +133,11 @@ Date: Sat, 20 Jul 2019 18:22:48 -0000 Hi P=E8rsonB, ``` -That's not an error; **P=E8rsonB** is the encoded form of **PèrsonB**. +没有问题,**P=E8rsonB**是**PèrsonB**的编码形式。 -#### Send a test message +#### 发送测试信息 -Now, send a test email with the command **mailmerge --no-dry-run**, which tells Mailmerge to send a message to the first email on the list: +现在,运行**mailmerge --no-dry-run**,Mailmerge将向收件人列表中的第一个人发送电子邮件: ``` @@ -171,13 +171,13 @@ Travel Budget: 1000 >>> Limit was 1 messages.  To remove the limit, use the --no-limit option. ``` -On the fourth to last line, you can see it prompts you for your password. If you're using two-factor authentication or domain-managed logins, you will need to create an application password that bypasses these controls. If you're using Gmail and similar systems, you can do it directly from the interface; otherwise, contact your email system administrator. This will not compromise the security of your email system, but you should still keep the password complex and secret. +倒数第4行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是Gmail或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 虽然这些步骤不会影响邮件系统的安全性,但是仍然有必要使用复杂的安全性好的密码。 -When I checked my email account, I received a beautifully formatted test email. If your test email looks ready, send all the emails by entering **mailmerge --no-dry-run --no-limit**. +我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行**mailmerge --no-dry-run --no-limit**发送所有的邮件了。 -### Send complex emails +### 发送复杂邮件 -You can really see the power of Mailmerge when you take advantage of [Jinja2 templating][12]. I've found it useful for including conditional text and sending attachments. Here is a complex template and the corresponding database: +只有充分了解了[Jinja2 templating][12],你才可能充分领略Mailmerge真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: ``` @@ -205,7 +205,7 @@ PersonA,[persona@fedoraproject.org][10],1500,No,visa_person_a.pdf PèrsonB,[personb@fedoraproject.org][11],500,Yes,visa_person_b.pdf ``` -There are two new things in this email. First, there's an attachment. I have to send visa invitation letters to international travelers to help them come to Flock, and the **ATTACHMENT** part of the header specifies which file to attach. To keep my directory clean, I put all of them in my Attachments subdirectory. Second, it includes conditional information about a hotel, because some people receive funding for their hotel stay, and I need to include those details for those who do. This is done with the **if** construction: +在这个邮件中有两项新内容。首先是附件,我需要向参加国际旅行的人发送签证邀请信,帮助他们来Flock,文件头的**附件**部分说明了要包含什么文件;为了保持我的文档目录清晰,我将所以的所有需要作为附件的文档保存于附件子目录下。其次是包含了关于宾馆的条件信息,因为有些人的旅行资金包含了住宿费用,我需要对涉及住宿的人员诉及相关信息,而这是通过**if**判断实现的: ``` @@ -214,14 +214,13 @@ Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) {%- endif %} ``` -This works just like an **if** in most programming languages. Jinja2 is very expressive and can do multi-level conditions. Experiment with making your life easier by including database elements that control the contents of the email. Using whitespace is important for email readability. The minus (**-**) symbols in **if** and **endif** are part of how Jinja2 controls [whitespace][13]. There are lots of options, so experiment to see what looks best for you. +这和大多数编程语言中的**if**判断是一样的。Jinja2实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。**if**和**endif**语句中的短线(**-**)是Jinja2控制符的一部分[whitespace][13]。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 -Also note that I extended the database with two fields, **Hotel** and **File**. These are the values that control the inclusion of the hotel text and provide the name of the attachment. In my example, PèrsonB and I got hotel funding, while PersonA didn't. +在上面的例子中,我在数据文件扩充了**Hotel**和**File**两个字段,这些字段的值控制着宾馆信息和附件文件名。另外,在上例中,我和PèrsonB有住宿资助,但PersonA没有。 -Doing a dry-run and sending the emails is the same whether you're using a simple or a complex template. Give it a try! - -你还可以尝试在邮件头中使用条件判断(**if** … **endif**). You can, for example, have an attachment only if one is in the database, or maybe you need to change the sender's name for some emails but not others. +对于简单邮件和复杂邮件而言,试运行及正式发送邮件的操作都是相同的。快去试试吧! +你还可以尝试在邮件头中使用条件判断(**if** … **endif**),比如你可以使发送给在数据库中的某人的邮件包含附件,或者改变对部分人改变发送人的信息。 ### Mailmerge的优点 Mailmerge是用来批量发送个性化邮件的简洁而高效的工具。每个人只接受到他需要的信息,其它额外的操作和细节都是透明的。 From a4f2a1e1fddec773419db9188ac1ac99ee756d90 Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Thu, 23 Jul 2020 11:53:09 +0800 Subject: [PATCH 03/13] Update 20190808 Sending custom emails with Python.md --- sources/tech/20190808 Sending custom emails with Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md index f46105b0b8..1eedc416bb 100644 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -171,7 +171,7 @@ Travel Budget: 1000 >>> Limit was 1 messages.  To remove the limit, use the --no-limit option. ``` -倒数第4行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是Gmail或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 虽然这些步骤不会影响邮件系统的安全性,但是仍然有必要使用复杂的安全性好的密码。 +在倒数第4行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是Gmail或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行**mailmerge --no-dry-run --no-limit**发送所有的邮件了。 From 2ca085aff41750bc787211d345996caf0345357f Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Thu, 23 Jul 2020 14:00:00 +0800 Subject: [PATCH 04/13] Update 20190808 Sending custom emails with Python.md --- sources/tech/20190808 Sending custom emails with Python.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md index 1eedc416bb..95a6943670 100644 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -9,12 +9,12 @@ 使用Python发送定制邮件 ====== -Mailmerge是一个可以处理简单邮件和复杂邮件的命令行程序,可以用它定制组邮件。 +Mailmerge是一个可以处理简单邮件和复杂邮件的命令行程序,可以用它定制群发邮件。 ![Chat via email][1] -电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在以自动化方式实现受众信息队列的场景。 +电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在以自动化群发方面。 -我作为[Fedora社区行动和影响协调员 ][2]的工作之一就是给人们发送旅行基金相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用[Mailmerge][3],一个可以处理简单邮件及复杂邮件的命令行程序,向一组人发送定制信息。 +我作为[Fedora社区行动和影响协调员 ][2]的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用[Mailmerge][3],一个可以处理简单邮件及复杂邮件的命令行程序,向一群人发送定制信息。 ### 安装 Mailmerge From 0feac10cb5906b78ad81e375655fed2252a8652d Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Thu, 23 Jul 2020 14:47:01 +0800 Subject: [PATCH 05/13] Update 20190808 Sending custom emails with Python.md --- ...90808 Sending custom emails with Python.md | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md index 95a6943670..81331ea9df 100644 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -7,36 +7,36 @@ [#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) [#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) -使用Python发送定制邮件 +使用 Python 发送定制邮件 ====== -Mailmerge是一个可以处理简单邮件和复杂邮件的命令行程序,可以用它定制群发邮件。 +Mailmerge 是一个可以处理简单邮件和复杂邮件的命令行程序,可以用它定制群发邮件。 ![Chat via email][1] 电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在以自动化群发方面。 -我作为[Fedora社区行动和影响协调员 ][2]的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用[Mailmerge][3],一个可以处理简单邮件及复杂邮件的命令行程序,向一群人发送定制信息。 +我作为 [Fedora 社区行动和影响协调员 ][2] 的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用 [Mailmerge][3] ,一个可以处理简单邮件及复杂邮件的命令行程序,向一群人发送定制信息。 ### 安装 Mailmerge -在Fedora中,Mailmerge已经打包可用,你可以通过在命令行中运行**sudo dnf install python3-mailmerge**来安装它。你还可以使用**pip**命令从PyPi中安装,具体可以参阅该项目的[说明][4]。 +在 Fedora 中,Mailmerge 已经打包可用,你可以通过在命令行中运行 **sudo dnf install python3-mailmerge** 来安装它。你还可以使用 **pip** 命令从 PyPi 中安装,具体可以参阅该项目的 [说明][4]。 ### 配置 Mailmerge -三个配置文件控制着Mailmerge的工作模式。运行**mailmerge --sample**,将生成配置文件模板。这些文件包括: +三个配置文件控制着 Mailmerge 的工作模式。运行 **mailmerge --sample** ,将生成配置文件模板。这些文件包括: * **mailmerge_server.conf:** 这里保存着SMTP服务端邮件发送相关详细配置,但你的密码 _不_ 在这里保存。 * **mailmerge_database.csv:** 这里保存每封邮件的个性数据,包括收件人电子邮件地址。 - * **mailmerge_template.txt:** 这里保存电子邮件的文本,文本中包含占位符,这些占位符会使用**mailmerge_database.csv**中的数据替换。 + * **mailmerge_template.txt:** 这里保存电子邮件的文本,文本中包含占位符,这些占位符会使用 **mailmerge_database.csv** 中的数据替换。 #### Server.conf -配置模板文件**mailmerge_server.conf**包含几个大家应该很熟悉的例子。如果你曾经往手机上添加过电子邮件或者设置过桌面电子邮件客户端,那你就应该看到过这些数据。需要提醒的是要记得把你的用户名更新到这个文件中,尤其是在你使用模板所提供的配置时。 +配置模板文件 **mailmerge_server.conf** 包含几个大家应该很熟悉的例子。如果你曾经往手机上添加过电子邮件或者设置过桌面电子邮件客户端,那你就应该看到过这些数据。需要提醒的是要记得把你的用户名更新到这个文件中,尤其是在你使用模板所提供的配置时。 #### Database.csv -**mailmerge_database.csv**这个配置文件稍微有点复杂。最起码要将邮件接收者的电子邮件地址保存在这里,其它在电子邮件中任何需要替换的定制信息也要保存在这里。推荐在创建本文件的占位符列表时,同步步编辑**mailmerge_template.txt**文件。我发现一个有效的做法是,使用电子表格软件录入这些数据,完成后导出为CSV文件。使用下面的示例文件: +**mailmerge_database.csv** 这个配置文件稍微有点复杂。最起码要将邮件接收者的电子邮件地址保存在这里,其它在电子邮件中任何需要替换的定制信息也要保存在这里。推荐在创建本文件的占位符列表时,同步步编辑 **mailmerge_template.txt** 文件。我发现一个有效的做法是,使用电子表格软件录入这些数据,完成后导出为 CSV 文件。使用下面的示例文件: ``` @@ -47,11 +47,11 @@ email,name,number 你可以使用他们的名字,给这两个人发送邮件,并各告诉他们一个数字。这个示例文件虽然不是特别有趣,但应用了一个重要的原则,那就是:始终让自己处于邮件接收列表的首位。这样你可以在向列表全员发送邮件之前,先给自己发送一个测试邮件,以验证邮件的效果是否如你预期。 -任何包含半角逗号的值,都 _**必须**_ 以半角双引号(**"**)封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中使用两个半角双引号。引用的定义规则比较有趣,去[Python3中的CSV][7]一探究竟吧。 +任何包含半角逗号的值,都 _**必须**_ 以半角双引号( **"** )封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中使用两个半角双引号。引用的定义规则比较有趣,去 [Python3中的CSV][7] 一探究竟吧。 #### Template.txt -我的工作之一,就是向Fedora贡献者协会发送与旅行基金有关的信息,[Flock][8]。通过简单的邮件告诉有关的人,他被选中为旅行基金支持的幸运者,以及相应基金支持的详细信息。与接收者相关的具体信息之一就是我们可以为他的旅行提供多少资助。下面是一份我的节略后的模板文件(为了简洁,已经移除大量的文本): +我的工作之一,就是向 Fedora 贡献者协会发送与旅行基金有关的信息,[Flock][8] 。通过简单的邮件告诉有关的人,他被选中为旅行基金支持的幸运者,以及相应基金支持的详细信息。与接收者相关的具体信息之一就是我们可以为他的旅行提供多少资助。下面是一份我的节略后的模板文件(为了简洁,已经移除大量的文本): ``` @@ -69,7 +69,7 @@ Travel Budget: {{Travel_Budget}} <<snip>> ``` -模板的起头定义了邮件的接收者、发送者和主题。在空行之后,是邮件的内容。该邮件需要从**database.csv**文件中获取接收者的**Email**、**Name**和**Travel_Budget**。注意,上述这些占位符是由双大括弧(**{{** **}}**)封闭的。相应的**mailmerge_database.csv**如下: +模板的起头定义了邮件的接收者、发送者和主题。在空行之后,是邮件的内容。该邮件需要从 **database.csv** 文件中获取接收者的 **Email** 、**Name** 和 **Travel_Budget** 。注意,上述这些占位符是由双大括弧( **{{** **}}** )封闭的。相应的 **mailmerge_database.csv** 如下: ``` @@ -80,7 +80,7 @@ PersonA,[persona@fedoraproject.org][10],1500 PèrsonB,[personb@fedoraproject.org][11],500 ``` -注意,我把自己放在了第一个,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人PèrsonB,他的名字中有一个包含变音符号的字母,Mailmerge会对这类字母自动编码。 +注意,我把自己放在了第一个,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人 PèrsonB ,他的名字中有一个包含变音符号的字母, Mailmerge 会对这类字母自动编码。 以上包含了模板的全部知识点:写上你自己的电子邮件信息,并编写好以双大括弧封闭的占位符。接下来创建用来提供前述占位符具体值的数据文件。现在测试一下电子邮件的效果。 @@ -88,7 +88,7 @@ PèrsonB,[personb@fedoraproject.org][11],500 #### 试运行 -测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令**mailmerge**,它将对收件列表中的第一个人进行试运行: +测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令 **mailmerge** ,它将对收件列表中的第一个人进行试运行: ``` @@ -117,7 +117,7 @@ Travel Budget: 1000 >>> This was a dry run.  To send messages, use the --no-dry-run option. ``` -从试运行生成的邮件中(**第0条信息**,和计算机中很多计数场景一样,计数从0开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行**mailmerge --no-limit**,告诉Mailmerge不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: +从试运行生成的邮件中(列表中的 **第 0 条信息** ,和计算机中很多计数场景一样,计数从 0 开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行 **mailmerge --no-limit** ,告诉 Mailmerge 不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: ``` @@ -133,11 +133,11 @@ Date: Sat, 20 Jul 2019 18:22:48 -0000 Hi P=E8rsonB, ``` -没有问题,**P=E8rsonB**是**PèrsonB**的编码形式。 +没有问题, **P=E8rsonB** 是 **PèrsonB** 的编码形式。 #### 发送测试信息 -现在,运行**mailmerge --no-dry-run**,Mailmerge将向收件人列表中的第一个人发送电子邮件: +现在,运行 **mailmerge --no-dry-run** , Mailmerge 将向收件人列表中的第一个人发送电子邮件: ``` @@ -171,13 +171,13 @@ Travel Budget: 1000 >>> Limit was 1 messages.  To remove the limit, use the --no-limit option. ``` -在倒数第4行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是Gmail或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 +在倒数第4行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是 Gmail 或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 -我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行**mailmerge --no-dry-run --no-limit**发送所有的邮件了。 +我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行 **mailmerge --no-dry-run --no-limit** 发送所有的邮件了。 ### 发送复杂邮件 -只有充分了解了[Jinja2 templating][12],你才可能充分领略Mailmerge真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: +只有充分了解了 [Jinja2 templating][12] ,你才可能充分领略 Mailmerge 真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: ``` @@ -205,7 +205,7 @@ PersonA,[persona@fedoraproject.org][10],1500,No,visa_person_a.pdf PèrsonB,[personb@fedoraproject.org][11],500,Yes,visa_person_b.pdf ``` -在这个邮件中有两项新内容。首先是附件,我需要向参加国际旅行的人发送签证邀请信,帮助他们来Flock,文件头的**附件**部分说明了要包含什么文件;为了保持我的文档目录清晰,我将所以的所有需要作为附件的文档保存于附件子目录下。其次是包含了关于宾馆的条件信息,因为有些人的旅行资金包含了住宿费用,我需要对涉及住宿的人员诉及相关信息,而这是通过**if**判断实现的: +在这个邮件中有两项新内容。首先是附件,我需要向参加国际旅行的人发送签证邀请信,帮助他们来 Flock,文件头的 **附件** 部分说明了要包含什么文件;为了保持我的文档目录清晰,我将所以的所有需要作为附件的文档保存于附件子目录下。其次是包含了关于宾馆的条件信息,因为有些人的旅行资金包含了住宿费用,我需要对涉及住宿的人员诉及相关信息,而这是通过 **if** 判断实现的: ``` @@ -214,18 +214,18 @@ Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) {%- endif %} ``` -这和大多数编程语言中的**if**判断是一样的。Jinja2实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。**if**和**endif**语句中的短线(**-**)是Jinja2控制符的一部分[whitespace][13]。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 +这和大多数编程语言中的 **if** 判断是一样的。Jinja2 实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。**if** 和 **endif** 语句中的短线( **-** )是 Jinja2 控制 [空歌字符][13] 的一部分。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 -在上面的例子中,我在数据文件扩充了**Hotel**和**File**两个字段,这些字段的值控制着宾馆信息和附件文件名。另外,在上例中,我和PèrsonB有住宿资助,但PersonA没有。 +在上面的例子中,我在数据文件扩充了 **Hotel** 和 **File** 两个字段,这些字段的值控制着宾馆信息和附件文件名。另外,在上例中,我和 PèrsonB 有住宿资助,但 PersonA 没有。 对于简单邮件和复杂邮件而言,试运行及正式发送邮件的操作都是相同的。快去试试吧! -你还可以尝试在邮件头中使用条件判断(**if** … **endif**),比如你可以使发送给在数据库中的某人的邮件包含附件,或者改变对部分人改变发送人的信息。 -### Mailmerge的优点 +你还可以尝试在邮件头中使用条件判断( **if** … **endif** ),比如你可以使发送给在数据库中的某人的邮件包含附件,或者改变对部分人改变发送人的信息。 +### Mailmerge 的优点 -Mailmerge是用来批量发送个性化邮件的简洁而高效的工具。每个人只接受到他需要的信息,其它额外的操作和细节都是透明的。 +Mailmerge 是用来批量发送个性化邮件的简洁而高效的工具。每个人只接受到他需要的信息,其它额外的操作和细节都是透明的。 -我还发现,即使是在发送简单的集团邮件时,相对于使用CC或者BCC向一组受众发送一封邮件,采用Mailmerge也是非常高效的。很多人使用了邮件过滤,那些不是直接发给他们的邮件,他们一律不会立刻处理。使用Mailmerge保证了每名受众接收到的就是自己的邮件。所有的信息会对接收者进行正确过滤,再也不会有人无意间回复到整个邮件组。 +我还发现,即使是在发送简单的集团邮件时,相对于使用CC或者BCC向一组受众发送一封邮件,采用 Mailmerge 也是非常高效的。很多人使用了邮件过滤,那些不是直接发给他们的邮件,他们一律不会立刻处理。使用 Mailmerge 保证了每名接收者收到的就是自己的邮件。所有的信息会对接收者进行正确过滤,再也不会有人无意间回复到整个邮件组。 -------------------------------------------------------------------------------- From 347053aeb21796ea1037c3e2d012c1e51aa43a0e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jul 2020 23:41:34 +0800 Subject: [PATCH 06/13] PRF @geekpi --- ...ade to Ubuntu 20.04 As Soon As Possible.md | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md b/translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md index 24731fb0da..c755a8d3dc 100644 --- a/translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md +++ b/translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md @@ -1,16 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible!) [#]: via: (https://itsfoss.com/ubuntu-19-10-end-of-life/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Ubuntu 19.10 产品寿命结束。尽快升级到 Ubuntu 20.04! +Ubuntu 19.10 产品寿命结束,尽快升级到 Ubuntu 20.04! ====== -_**Ubuntu 19.10 Eoan Ermine 产品寿命结束。这意味着它不会获得任何安全或维护更新。继续使用 Ubuntu 19.10 将很危险,因为你的系统将来可能会因为缺少安全更新而变得脆弱。你应该升级到 Ubuntu 20.04。**_ +> Ubuntu 19.10 Eoan Ermine 产品寿命结束。这意味着它不会获得任何安全或维护更新。继续使用 Ubuntu 19.10 将很危险,因为你的系统将来可能会因为缺少安全更新而变得脆弱。你应该升级到 Ubuntu 20.04。 [2019 年 10 月发布的 Ubuntu 19.10][1] 带来了一些为 [Ubuntu 20.04][2] 做准备的新功能。 @@ -22,13 +22,11 @@ _**Ubuntu 19.10 Eoan Ermine 产品寿命结束。这意味着它不会获得任 我之前已经[详细解释了 Ubuntu 的发布周期和产品寿命结束][4]。如果此后继续使用 Ubuntu 19.10,我会重申这对你和你的系统意味着什么。 -[软件通常有预定义的生命周期][5],一旦软件版本到达生命周期结束,它将停止获取更新和支持。 - -生命周期结束后,Ubuntu 19.10 不再会从 Ubuntu 获得系统更新、安全更新或应用更新。 +[软件通常有预定义的生命周期][5],一旦软件版本到达生命周期结束,它将停止获取更新和支持。生命周期结束后,Ubuntu 19.10 不再会从 Ubuntu 获得系统更新、安全更新或应用更新。 如果你继续使用它,你的系统可能会成为潜在的网络攻击的受害者,因为黑客往往会利用脆弱的系统。 -之后,你可能无法使用 apt 命令安装新软件,因为 Ubuntu 将归档 19.10 的仓库。 +之后,你可能无法使用 `apt` 命令安装新软件,因为 Ubuntu 将归档 19.10 的仓库。 ### 如果你使用的是 Ubuntu 19.10,该怎么办? @@ -48,10 +46,9 @@ Codename: Eoan 如果你看到 Ubuntu 19.10,你应该做以下两项工作之一: -* 如果你有良好,稳定的互联网连接,从 Ubuntu 19.10 升级到 20.04。你的个人文件和大多数软件保持不变。 +* 如果你有良好、稳定的互联网连接,从 Ubuntu 19.10 升级到 20.04。你的个人文件和大多数软件保持不变。 * 如果你有着缓慢或不稳定的互联网连接,你应该[全新安装的 Ubuntu 20.04][7]。你的文件和磁盘上的所有内容将被擦除,因此你应该在外部磁盘上备份重要数据。 - #### 如何从 19.10 升级到 20.04 (如果你有良好的互联网连接) 我之前已经详细讨论了 Ubuntu 版本升级。我会在这里快速说下步骤。 @@ -74,13 +71,13 @@ Codename: Eoan ![][10] -这样升级会保持你的家目录。不过,仍建议在外部磁盘进行备份。 +这样的升级会保持你的家目录。不过,仍建议在外部磁盘进行备份。 ### 你仍在使用 Ubuntu 19.10 吗? 如果你仍在使用 Ubuntu 19.10,那么必须为升级或全新安装做好准备。你不能忽视它。 -如果你不喜欢这样的频繁版本升级,你应该使用支持五年的 LTS 版本。当前的 LTS 版本是 Ubuntu 20.04,你无论如何都要升级到它。 +如果你不喜欢这样的频繁版本升级,你应该使用支持五年的 LTS 版本。当前的 LTS 版本是 Ubuntu 20.04,你无论如何都应该升级到它。 你是否正在使用 Ubuntu 19.10?你是否已升级到 Ubuntu 20.04?如果你面临任何问题,或者如果你有任何问题,请让我知道。 @@ -91,7 +88,7 @@ via: https://itsfoss.com/ubuntu-19-10-end-of-life/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 4e90478df72b6bf4ded80e29e33ceaedcc43a2a2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 23 Jul 2020 23:42:12 +0800 Subject: [PATCH 07/13] PUB @geekpi https://linux.cn/article-12446-1.html --- ...nd of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md (98%) diff --git a/translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md b/published/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md similarity index 98% rename from translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md rename to published/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md index c755a8d3dc..a3e48b4bb3 100644 --- a/translated/tech/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md +++ b/published/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12446-1.html) [#]: subject: (Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible!) [#]: via: (https://itsfoss.com/ubuntu-19-10-end-of-life/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From f93b2fe6b642f953924cdf024186238de21fec64 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jul 2020 05:02:03 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200723=20Au?= =?UTF-8?q?tomate=20testing=20for=20website=20errors=20with=20this=20Pytho?= =?UTF-8?q?n=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200723 Automate testing for website errors with this Python tool.md --- ...or website errors with this Python tool.md | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 sources/tech/20200723 Automate testing for website errors with this Python tool.md diff --git a/sources/tech/20200723 Automate testing for website errors with this Python tool.md b/sources/tech/20200723 Automate testing for website errors with this Python tool.md new file mode 100644 index 0000000000..aaf90a1a33 --- /dev/null +++ b/sources/tech/20200723 Automate testing for website errors with this Python tool.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automate testing for website errors with this Python tool) +[#]: via: (https://opensource.com/article/20/7/seodeploy) +[#]: author: (JR Oakes https://opensource.com/users/jroakes) + +Automate testing for website errors with this Python tool +====== +SEODeploy helps identify SEO problems in a website before they're +deployed. +![Computer screen with files or windows open][1] + +As a technical search-engine optimizer, I'm often called in to coordinate website migrations, new site launches, analytics implementations, and other areas that affect sites' online visibility and measurement to limit risk. Many companies generate a substantial portion of monthly recurring revenue from users finding their products and services through search engines. Although search engines have gotten good at handling poorly formatted code, things can still go wrong in development that adversely affects how search engines index and display pages for users. + +I've been part of manual processes attempting to mitigate this risk by reviewing staged changes for search engine optimization (SEO)-breaking problems. My team's findings determine whether the project gets the green light (or not) to launch. But this process is often inefficient, can be applied to only a limited number of pages, and has a high likelihood of human error. + +The industry has long sought a usable and trustworthy way to automate this process while still giving developers and search-engine optimizers a meaningful say in what must be tested. This is important because these groups often have competing priorities in development sprints, with search-engine optimizers pushing for changes and developers needing to control regressions and unexpected experiences. + +### Common SEO-breaking problems + +Many websites I work with have tens of thousands of pages. Some have millions. It's daunting to understand how a development change might affect so many pages. In the world of SEO, you can see large, sitewide changes in how Google and other search engines show your pages from very minor and seemingly innocuous changes. It's imperative to have processes in place that catch these types of errors before they make it to production. + +Below are a few examples of problems that I have seen in the last year. + +#### Accidental noindex + +A proprietary third-party SEO monitoring tool we use, [ContentKing][2], found this problem immediately after launch to production. This is a sneaky error because it's not visible in the HTML, rather it is hidden from view in the server response header, yet it can very quickly cause the loss of your search visibility. + + +``` +HTTP/1.1 200 OK +Date: Tue May 25 2010 21:12:42 GMT +[...] +X-Robots-Tag: noindex +[...] +``` + +#### Canonical lower-casing + +A change to production mistakenly lower-cased an entire website's [canonical link elements][3]. The change affected nearly 30,000 URLs. Before the update, the URLs were in title case (for instance, `/URL-Path/`). This is a problem because the canonical link element is a hint for Google about a webpage's true canonical URL version. This change caused many URLs to be removed from Google's index and re-indexed at the new uncased location (`/url-path/`). The impact was a loss of 10–15% of traffic and corruption of page metric data over the next few weeks. + +#### Origin server regression + +One website with a complex and novel implementation of React had a mysterious issue with regression of `origin.domain.com` URLs displaying for its origin content-delivery network server. It would intermittently output the origin host instead of the edge host in the site metadata (such as the canonical link element, URLs, and Open Graph links). The problem was found in the raw HTML and the rendered HTML. This impacted search visibility and the quality of shares on social media. + +### Introducing SEODeploy + +SEOs often use diff-testing tools to look at changes between sets of rendered and raw HTML. Diff testing is ideal because it allows certainty that the eye does not. You want to look for differences in how Google renders your page, not how users do. You want to look at what the raw HTML looks like, not the rendered HTML, as these are two separate processing steps for Google. + +This led my colleagues and me to create [SEODeploy][4], a "Python library for automating SEO testing in deployment pipelines." Our mission was: + +> To develop a tool that allowed developers to provide a few to many URL paths, and which allowed those paths to be diff tested on production and staging hosts, looking specifically for unanticipated regressions in SEO-related data. + +SEODeploy's mechanics are simple: Provide a text file containing a newline-delimited set of paths, and the tool runs a series of modules on those paths, comparing production and staging URLs and reporting on any errors or messages (changes) it finds. + +![SEODeploy overview][5] + +(SEODeploy, [CC BY-SA 4.0][6]) + +The configuration for the tool and modules is just one YAML file, which can be customized based on anticipated changes. + +![SEODeploy output][7] + +(SEODeploy, [CC BY-SA 4.0][6]) + +The initial release includes the following core features and concepts: + + 1. **Open source**: We believe deeply in sharing code that can be criticized, improved, extended, shared, and reused. + 2. **Modular**: There are many different stacks and edge cases in development for the web. The SEODeploy tool is conceptually simple, so modularity is used to control the complexity. We provide two built modules and an example module that outline the basic structure. + 3. **URL sampling:** Since it is not always feasible or efficient to test every URL, we included a method to randomly sample XML sitemap URLs or URLs monitored by ContentKing. + 4. **Flexible diff checking**: Web data is messy. The diff checking functionality tries to do a good job of converting this data to messages (changes) no matter the data type it's checking, including ext, arrays (lists), JSON objects (dictionaries), integers, floats, etc. + 5. **Automated**: A simple command-line interface is used to call the sampling and execution methods to make it easy to incorporate SEODeploy into existing pipelines. + + + +### Modules + +While the core functionality is simple, by design, modules are where SEODeploy gains features and complexity. The modules handle the harder task of getting, cleaning, and organizing the data collected from staging and production servers for comparison. + +#### Headless module + +The tool's [Headless module][8] is a nod to anyone who doesn't want to have to pay for a third-party service to get value from the library. It runs any version of Chrome and extracts rendered data from each comparison set of URLs. + +The headless module extracts the following core data for comparison: + + 1. SEO content, e.g., titles, headings, links, etc. + 2. Performance data from the Chrome Timings and Chrome DevTools Protocol (CDP) Performance APIs + 3. Calculated performance metrics including the Cumulative Layout Shift (CLS), a recently popular [Web Vital][9] released by Google + 4. Coverage data for CSS and JavaScript from the CDP Coverage API + + + +The module includes functionality to handle authentication for staging, network speed presets (for better normalization of comparisons), as well as a method for handling staging-host replacement in staging comparative data. It should be fairly easy for developers to extend this module to collect any other data they want to compare per page. + +#### Other modules + +We created an [example module][10] for any developer who wants to use the framework to create a custom extraction module. Another module integrates with ContentKing. Note that the ContentKing module requires a subscription to ContentKing, while Headless can be run on any machine capable of running Chrome. + +### Problems to solve + +We have [plans][11] to extend and enhance the library but are looking for [feedback][12] from developers on what works and what doesn't meet their needs. A few of the issues and items on our list are: + + 1. Dynamic timestamps create false positives for some comparison elements, especially schema. + 2. Saving test data to a database to enable reviewing historical deployment processes and testing changes against the last staging push. + 3. Enhancing the scale and speed of the extraction with a cloud infrastructure for rendering. + 4. Increasing testing coverage from the current 46% to 99%-plus. + 5. Currently, we rely on [Poetry][13] for dependency management, but we want to publish a PyPl library so it can be installed easily with `pip install`. + 6. We are looking for more issues and field data on usage. + + + +### Get started + +The project is [on GitHub][4], and we have [documentation][14] for most features. + +We hope that you will clone SEODeploy and give it a go. Our goal is to support the open source community with a tool developed by technical search-engine optimizers and validated by developers and engineers. We've seen the time it takes to validate complex staging issues and the business impact minor changes can have across many URLs. We think this library can save time and de-risk the deployment process for development teams. + +If you have questions, issues, or want to contribute, please see the project's [About page][15]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/seodeploy + +作者:[JR Oakes][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jroakes +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) +[2]: https://www.contentkingapp.com/ +[3]: https://en.wikipedia.org/wiki/Canonical_link_element +[4]: https://github.com/locomotive-agency/SEODeploy +[5]: https://opensource.com/sites/default/files/uploads/seodeploy.png (SEODeploy overview) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/seodeploy_output.png (SEODeploy output) +[8]: https://locomotive-agency.github.io/SEODeploy/modules/headless/ +[9]: https://web.dev/vitals/ +[10]: https://locomotive-agency.github.io/SEODeploy/modules/creating/ +[11]: https://locomotive-agency.github.io/SEODeploy/todo/ +[12]: https://locomotive-agency.github.io/SEODeploy/about/#contact +[13]: https://python-poetry.org/ +[14]: https://locomotive-agency.github.io/SEODeploy/ +[15]: https://locomotive-agency.github.io/SEODeploy/about/ From 197aa3b15cb0a1b2a9449cf23be115af620af3b0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 24 Jul 2020 05:02:15 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E9=80=89=E9=A2=98[tech]:=2020200723=20Bu?= =?UTF-8?q?ild=20your=20own=20open=20source=20alternative=20to=20Google=20?= =?UTF-8?q?Suite=20with=20Nextcloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20200723 Build your own open source alternative to Google Suite with Nextcloud.md --- ...ernative to Google Suite with Nextcloud.md | 127 ++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 sources/tech/20200723 Build your own open source alternative to Google Suite with Nextcloud.md diff --git a/sources/tech/20200723 Build your own open source alternative to Google Suite with Nextcloud.md b/sources/tech/20200723 Build your own open source alternative to Google Suite with Nextcloud.md new file mode 100644 index 0000000000..87cbc1a101 --- /dev/null +++ b/sources/tech/20200723 Build your own open source alternative to Google Suite with Nextcloud.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Build your own open source alternative to Google Suite with Nextcloud) +[#]: via: (https://opensource.com/article/20/7/nextcloud) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Build your own open source alternative to Google Suite with Nextcloud +====== +The open source cloud collaboration suite has made major gains in recent +years. Take a look at what you've missed. +![Digital images of a computer desktop][1] + +A few years ago, I installed [Nextcloud][2] for a local theatre and museum that was looking for an on-premises cloud solution. As an advocate for open source, I always seek out open source options first, and Nextcloud was the most-common open source cloud solution among my peers. I've also used it for some personal projects, but I hadn't looked at it in a while. + +I recently revisited Nextcloud and was amazed by all the changes I saw. The project has evolved into a complete solution that can replace big-name solutions like Google Drive and Microsoft 365. Nextcloud's new feature set, especially [Nextcloud Hub][3], is outstanding, offering collaborative documentation editing, file version control, integrated chat and video calling, and more. + +### Getting started with Nextcloud + +There are many options for [setting up a Nextcloud server on Linux][4], but I decided to run the official [container image][5]. I pulled it down to my laptop, and soon I was up and running. + + +``` +$ docker pull nextcloud +$ docker run -d -p 8080:80 nextcloud +``` + +Installation was quick on my MacBook Pro with 8GB RAM. In no time at all, I was logging into Nextcloud for the first time at `http://locahost:8080` with the default credentials of _admin_ and _password_. + +![Nextcloud login interface][6] + +(Don Watkins, [CC BY-SA 4.0][7]) + +After I entered my login credentials, it began downloading some applications, which took some time. I appreciated that Nextcloud's interface looked much the same as it did years ago, even with all the changes in the platform, because I like to feel familiar with a technology. + +![Nextcloud's UI][8] + +(Don Watkins, [CC BY-SA 4.0][7]) + +Nextcloud's controls are located in the upper-right corner. You can control settings, add apps, create and modify users, learn about Nextcloud, get help, and log out. + +Nextcloud Hub is a central collaboration platform where you can access and collaborate on files, launch, enable, and disable applications, manage your calendar, and more. + +I decided to start by exploring the apps available in Nextcloud. Some app integrations are included by default, and you can download others with a single click. For example, here is the display when I clicked the top-right icon, then selected Apps and Multimedia. + +![Nextcloud multimedia apps][9] + +(Don Watkins, [CC BY-SA 4.0][7]) + +There are hundreds of apps that can be downloaded and added to Nextcloud, and, like Nextcloud, all are licensed under the [AGPLv3][10]. Clicking on an app shows information about it, including its creator and license. I decided to look at [Audio Player][11]. + +![Nextcloud Audio Player][12] + +(Don Watkins, [CC BY-SA 4.0][7]) + +Nextcloud also comes with the [Nextcloud Talk][13] app for videoconferencing with complete end-to-end encryption to keep communication within your control. As of Nextcloud Hub 19, you can work on documents synchronously during video calls with [Collabora Online][14], which will feel familiar to Google Docs users. + +Nextcloud also has a number of important security features, including optional automatic logout, which is useful when using public computers. You can also set up passwordless authentication, automatic account locking after failed login attempts, and two-factor authentication (2FA) through mobile, email, or one-time password devices to verify users' identity before they can log in. + +### Nextcloud's advances + +Eager to learn more about Nextcloud and its new directions, I reached out to CEO [Frank Karlitschek][15] to ask him some questions by email. + +During this time of social distancing, I was curious about how the growth of remote work is fueling Nextcloud's development. Frank says the fact that the world is [working from home][16] is accelerating the adoption of content collaboration software, and Nextcloud is "in the lucky situation that we heavily invested in this fast-growing product category." He specifically cites Nextcloud's abilities to sync, share, and collaboratively view and edit files, as well as its shared calendars, contacts, email, chats, video calls, project management, notes, and many more things as features that help people work together. + +Frank adds, "Nextcloud Talk is our solution for chat and audio and video calls. It has the same benefits as the rest of Nextcloud. All data and communication stay under your control. It is fully open source; you can migrate your data and don't need to trust a third-party company." + +Open source is a key part of Nextcloud's model, Frank says. "Everything server-side is licensed AGPL, and the desktop and mobile clients are licensed GPL. We are happy to not have any proprietary pieces. Everything at Nextcloud is fully free software and open source." + +When I asked him why someone should choose Nextcloud over a proprietary cloud solution, Frank emphasizes the freedom to run where you want with 100% open source software. "Being open source has many benefits for users. It means you can keep your data under your own control. You can run Nextcloud wherever you want. Vendor lock-in is eliminated, so you can move your data around to where you need it. The open source code in Nextcloud ensures that there are no backdoors because the code can be audited. The open source angle has also empowered developers to extend Nextcloud with hundreds of apps, extensions, and plugins." + +I was also curious about Nextcloud's security, including its support for [Nitrokey][17], a feature for passwordless authentication. Frank says, "Nextcloud supports authentication from many different protocols, including LDAP, Active Directory, SAML, OAuth, OpenID connect, WebAuthn, and many more. You can use second-factor authentication methods, including Time-based One-time Password (TOTP), SMS, push notification, SecSign, and email. With the new support for [WebAuthn][18], we also support the new passwordless authentication. Nitrokey already supports this, so you can just authenticate with a Nitrokey without a password. We expect that a lot more devices and software will support this new open standard in the future." + +As I thought about all the changes in Nextcloud, I wondered about its install base. Being open source makes it impossible to know how many Nextcloud installations there are in the world. One of its [container images][19] has over 100 million downloads, and it has a strong following in its source repository on [GitHub][20]. Nextcloud estimates there are over 400,000 Nextcloud servers on the internet, and that number is growing. + +Nextcloud doesn't provide hosting options itself, but it does list service [providers][21] that offer hosted Nextcloud. There are also many options for self-hosting Nextcloud, Frank says. "A Nextcloud server can be very small or very big. Actually, Nextcloud runs fine on a Raspberry Pi for just a few users. This includes chatting and video calling. The Nextcloud server needs a decent network connection if you handle big files or video calls with a lot of users." + +### Open source to its core + +Frank was eager to thank the open source community that comes together and builds great software. He said, "open source is all about the community; no single person or company could do this alone." Therefore, Nextcloud welcomes [contributions][22] to its development. Nextcloud's code is available on [GitHub][23]. To keep up with the latest information, you can follow Nextcloud on [Twitter][24], [Instagram][25], [Facebook][26], [LinkedIn][27], [Mastodon][28], and [YouTube][29]. + +Sandstorm's Jade Wang shares some of her favorite open source web apps that are self-hosted... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/nextcloud + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://nextcloud.com/ +[3]: https://nextcloud.com/hub/ +[4]: https://docs.nextcloud.com/server/19/admin_manual/installation/index.html +[5]: https://hub.docker.com/_/nextcloud/ +[6]: https://opensource.com/sites/default/files/uploads/nextcloud_login.png (Nextcloud login interface) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.com/sites/default/files/uploads/nextcloud_interface.png (Nextcloud's UI) +[9]: https://opensource.com/sites/default/files/uploads/nextcloud_multimedia-apps.png (Nextcloud multimedia apps) +[10]: https://www.gnu.org/licenses/agpl-3.0.en.html +[11]: https://apps.nextcloud.com/apps/audioplayer +[12]: https://opensource.com/sites/default/files/uploads/nextcloud_audio-player_0.png (Nextcloud Audio Player) +[13]: https://nextcloud.com/talk/ +[14]: https://nextcloud.com/collaboraonline/ +[15]: https://en.wikipedia.org/wiki/Frank_Karlitschek +[16]: https://opensource.com/tags/wfh +[17]: https://www.nitrokey.com/ +[18]: https://en.wikipedia.org/wiki/WebAuthn +[19]: https://hub.docker.com/r/linuxserver/nextcloud/ +[20]: https://github.com/nextcloud/server +[21]: https://nextcloud.com/providers/ +[22]: https://nextcloud.com/contribute/ +[23]: https://github.com/nextcloud +[24]: https://twitter.com/nextclouders +[25]: https://instagram.com/nextclouders +[26]: https://www.facebook.com/Nextclouders/ +[27]: https://www.linkedin.com/company/10827569/ +[28]: https://mastodon.xyz/@nextcloud +[29]: https://youtube.com/nextcloud From c14a4ad79b894f814a5dc9ec6787e931531d312c Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 24 Jul 2020 08:35:28 +0800 Subject: [PATCH 10/13] translated --- ...ory Consumption Processes Runs on Linux.md | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) rename {sources => translated}/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md (66%) diff --git a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md b/translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md similarity index 66% rename from sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md rename to translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md index cfd2ceb7eb..f6771dd3a1 100644 --- a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md +++ b/translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md @@ -7,36 +7,36 @@ [#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux +在 Linux 中运行 Bash 脚本检查高 CPU/内存消耗进程 ====== -In the past, we have written three different articles to identify this using Linux commands. +过去,我们写了三篇不同的文章来使用 Linux 命令来识别。 -You can access them immediately by going to the relevant URLs below. +你可以通过下面相关的 URL 立即访问。 - * **[How to Find High CPU Consumption Processes in Linux][1]** - * **[How to Find Out Top Memory Consuming Processes in Linux][2]** - * **[Five Ways to Check How Long a Process Has Been Running in Linux][3]** + * **[如何在 Linux 中查找高 CPU 消耗进程][1]** + * **[如何找出 Linux 中的高内存消耗进程][2]** + * **[检查进程在 Linux 中运行了多长时间的五种方法][3]** -Two scripts are included in this tutorial, which helps you to identify how long the high CPU/memory consumption processes are running on Linux. +本教程中包含两个脚本,它们可以帮助你确定 Linux 上高 CPU/内存消耗进程的运行时间。 -The script will show you the process ID, the owner of the process, the name of the process and how long the processes are running. +该脚本将显示进程 ID,进程的所有者,进程的名称以及进程的运行时间。 -This will help you identify which jobs are running overtime (which must be completed beforehand). +这将帮助你确定哪些(必须事先完成)作业正在超时运行。 -This can be achieved using the ps command. +在可以使用 ps 命令来实现。 -### What’s ps Command +### 什么是 ps 命令 -ps stands for processes status, it display the information about the active/running processes on the system. +ps 代表进程状态,它显示有关系统上活动/正在运行的进程的信息。 -It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. +它提供了当前进程的快照以及详细信息,例如用户名、用户 ID、CPU 使用率、内存使用率、进程开始日期和时间等。 -### 1) Bash Script to Check How Long the High CPU Consumption Processes Runs on Linux +### 1)Bash 脚本检查高 CPU 消耗进程在 Linux 上运行了多长时间 -This script will help you to identify how long the high CPU consumption processes has been running on Linux. +该脚本将帮助你确定高 CPU 消耗进程在 Linux 上运行了多长时间。 ``` # vi /opt/scripts/long-running-cpu-proc.sh @@ -56,13 +56,13 @@ done | column -t echo "--------------------------------------------------" ``` -Set an executable **[Linux file permission][4]** to **“long-running-cpu-proc.sh”** file. +给 **”long-running-cpu-proc.sh“** 设置可执行**[Linux 文件权限][4]**。 ``` # chmod +x /opt/scripts/long-running-cpu-proc.sh ``` -When you run this script, you will get an output like the one below. +运行此脚本时,你将获得类似以下的输出。 ``` # sh /opt/scripts/long-running-cpu-proc.sh @@ -82,9 +82,9 @@ daygeek 6301 Web 57:40 ---------------------------------------------------- ``` -### 2) Bash Script to Check How Long the High Memory Consumption Processes Runs on Linux +### 2)Bash 脚本检查高内存消耗进程在 Linux 上运行了多长时间 -This script will help you to identify how long the top memory consumption processes has been running on Linux. +该脚本将帮助你确定最大的内存消耗进程在 Linux 上运行了多长时间。 ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -104,13 +104,13 @@ done | column -t echo "--------------------------------------------------" ``` -Set an executable Linux file permission to **“long-running-memory-proc.sh”** file. +给 **”long-running-memory-proc.sh“** 设置可执行 Linux 文件权限。 ``` # chmod +x /opt/scripts/long-running-memory-proc.sh ``` -When you run this script, you will get an output like the one below. +运行此脚本时,你将获得类似以下的输出。 ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -136,7 +136,7 @@ via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[geekpi](https://github.com/geekpi) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5d69a46645c329b6a9a673411564fddee82f2c00 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 24 Jul 2020 08:44:59 +0800 Subject: [PATCH 11/13] translating --- ...The feature that makes D my favorite programming language.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20200722 The feature that makes D my favorite programming language.md b/sources/tech/20200722 The feature that makes D my favorite programming language.md index 56b00fc929..fda0fb41f5 100644 --- a/sources/tech/20200722 The feature that makes D my favorite programming language.md +++ b/sources/tech/20200722 The feature that makes D my favorite programming language.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f37a9be0b2923e3f3b02927ad542ec7fc3acaff3 Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Fri, 24 Jul 2020 12:00:49 +0800 Subject: [PATCH 12/13] Update 20190808 Sending custom emails with Python.md --- ...90808 Sending custom emails with Python.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md index 81331ea9df..5fc4b9dee1 100644 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ b/sources/tech/20190808 Sending custom emails with Python.md @@ -14,7 +14,7 @@ Mailmerge 是一个可以处理简单邮件和复杂邮件的命令行程序, 电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在以自动化群发方面。 -我作为 [Fedora 社区行动和影响协调员 ][2] 的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用 [Mailmerge][3] ,一个可以处理简单邮件及复杂邮件的命令行程序,向一群人发送定制信息。 +我作为 [Fedora 社区行动和影响协调员][2] 的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用 [Mailmerge][3],一个可以处理简单邮件及复杂邮件的命令行程序,向一群人发送定制信息。 ### 安装 Mailmerge @@ -22,7 +22,7 @@ Mailmerge 是一个可以处理简单邮件和复杂邮件的命令行程序, ### 配置 Mailmerge -三个配置文件控制着 Mailmerge 的工作模式。运行 **mailmerge --sample** ,将生成配置文件模板。这些文件包括: +三个配置文件控制着 Mailmerge 的工作模式。运行 **mailmerge --sample**,将生成配置文件模板。这些文件包括: * **mailmerge_server.conf:** 这里保存着SMTP服务端邮件发送相关详细配置,但你的密码 _不_ 在这里保存。 * **mailmerge_database.csv:** 这里保存每封邮件的个性数据,包括收件人电子邮件地址。 @@ -47,7 +47,7 @@ email,name,number 你可以使用他们的名字,给这两个人发送邮件,并各告诉他们一个数字。这个示例文件虽然不是特别有趣,但应用了一个重要的原则,那就是:始终让自己处于邮件接收列表的首位。这样你可以在向列表全员发送邮件之前,先给自己发送一个测试邮件,以验证邮件的效果是否如你预期。 -任何包含半角逗号的值,都 _**必须**_ 以半角双引号( **"** )封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中使用两个半角双引号。引用的定义规则比较有趣,去 [Python3中的CSV][7] 一探究竟吧。 +任何包含半角逗号的值,都 _**必须**_ 以半角双引号( **"** )封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中使用两个半角双引号。引用的定义规则比较有趣,去 [Python 3 中的 CSV][7] 一探究竟吧。 #### Template.txt @@ -80,7 +80,7 @@ PersonA,[persona@fedoraproject.org][10],1500 PèrsonB,[personb@fedoraproject.org][11],500 ``` -注意,我把自己放在了第一个,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人 PèrsonB ,他的名字中有一个包含变音符号的字母, Mailmerge 会对这类字母自动编码。 +注意,我把自己的信息放在了首条,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人 PèrsonB,他的名字中有一个包含变音符号的字母,Mailmerge 会对这类字母自动编码。 以上包含了模板的全部知识点:写上你自己的电子邮件信息,并编写好以双大括弧封闭的占位符。接下来创建用来提供前述占位符具体值的数据文件。现在测试一下电子邮件的效果。 @@ -88,7 +88,7 @@ PèrsonB,[personb@fedoraproject.org][11],500 #### 试运行 -测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令 **mailmerge** ,它将对收件列表中的第一个人进行试运行: +测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令 **mailmerge**,它将对收件列表中的第一个人进行试运行: ``` @@ -117,7 +117,7 @@ Travel Budget: 1000 >>> This was a dry run.  To send messages, use the --no-dry-run option. ``` -从试运行生成的邮件中(列表中的 **第 0 条信息** ,和计算机中很多计数场景一样,计数从 0 开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行 **mailmerge --no-limit** ,告诉 Mailmerge 不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: +从试运行生成的邮件中(列表中的 **第 0 条信息** ,和计算机中很多计数场景一样,计数从 0 开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行 **mailmerge --no-limit**,告诉 Mailmerge 不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: ``` @@ -133,11 +133,11 @@ Date: Sat, 20 Jul 2019 18:22:48 -0000 Hi P=E8rsonB, ``` -没有问题, **P=E8rsonB** 是 **PèrsonB** 的编码形式。 +没有问题,**P=E8rsonB** 是 **PèrsonB** 的编码形式。 #### 发送测试信息 -现在,运行 **mailmerge --no-dry-run** , Mailmerge 将向收件人列表中的第一个人发送电子邮件: +现在,运行 **mailmerge --no-dry-run**,Mailmerge 将向收件人列表中的第一个人发送电子邮件: ``` @@ -171,13 +171,13 @@ Travel Budget: 1000 >>> Limit was 1 messages.  To remove the limit, use the --no-limit option. ``` -在倒数第4行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是 Gmail 或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 +在倒数第 4 行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是 Gmail 或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。 上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行 **mailmerge --no-dry-run --no-limit** 发送所有的邮件了。 ### 发送复杂邮件 -只有充分了解了 [Jinja2 templating][12] ,你才可能充分领略 Mailmerge 真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: +只有充分了解了 [Jinja2 模板][12] ,你才可能充分领略 Mailmerge 真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: ``` @@ -214,7 +214,7 @@ Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) {%- endif %} ``` -这和大多数编程语言中的 **if** 判断是一样的。Jinja2 实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。**if** 和 **endif** 语句中的短线( **-** )是 Jinja2 控制 [空歌字符][13] 的一部分。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 +这和大多数编程语言中的 **if** 判断是一样的。Jinja2 实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。**if** 和 **endif** 语句中的短线( **-** )是 Jinja2 控制 [空白字符][13] 的一部分。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 在上面的例子中,我在数据文件扩充了 **Hotel** 和 **File** 两个字段,这些字段的值控制着宾馆信息和附件文件名。另外,在上例中,我和 PèrsonB 有住宿资助,但 PersonA 没有。 From 6e0dd4e112909a02847c0af5182b4c782be0816c Mon Sep 17 00:00:00 2001 From: silentdawn-zz Date: Fri, 24 Jul 2020 13:28:25 +0800 Subject: [PATCH 13/13] change position of translated. finish translating. --- .../tech/20190808 Sending custom emails with Python.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20190808 Sending custom emails with Python.md (100%) diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/translated/tech/20190808 Sending custom emails with Python.md similarity index 100% rename from sources/tech/20190808 Sending custom emails with Python.md rename to translated/tech/20190808 Sending custom emails with Python.md