https://gist.github.com/JosefJezek/6194563上找到的一个配置脚本,下载后添加可执行权限,然后运行即可。

下面是脚本setup-msmtp-for-gmail.sh的内容

#!/bin/sh
# Sending emails using Gmail and msmtp
# Author: [Josef Jezek](http://about.me/josefjezek)
# Donate: [Gittip](https://www.gittip.com/josefjezek)
# Link: [Gist](https://gist.github.com/6194563)
# Usage: setup-msmtp-for-gmail.sh sudo apt-get update -q
sudo apt-get install msmtp-mta ca-certificates heirloom-mailx -yq if command -v zenity >/dev/null; then
GMAIL_USER=$(zenity --entry --title="Gmail username" --text="Enter your gmail username with domain (username@gmail.com):")
GMAIL_PASS=$(zenity --entry --title="Gmail password" --text="Enter your gmail password:" --hide-text)
else
read -p "Gmail username with domain (username@gmail.com): " GMAIL_USER
read -p "Gmail password: " GMAIL_PASS
fi echo # an empty line if [ -z "$GMAIL_USER" ]; then echo "No gmail username given. Exiting."; exit -; fi
if [ -z "$GMAIL_PASS" ]; then echo "No gmail password given. Exiting."; exit -; fi sudo tee /etc/msmtprc >/dev/null <<__EOF
# Accounts will inherit settings from this section
defaults
auth on
tls on
tls_certcheck off
# tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile /var/log/msmtp.log # A first gmail address
account gmail
host smtp.gmail.com
port
from $GMAIL_USER
user $GMAIL_USER
password $GMAIL_PASS # A second gmail address
account gmail2 : gmail
from username@gmail.com
user username@gmail.com
password password # A freemail service
account freemail
host smtp.freemail.example
from joe_smith@freemail.example
user joe.smith
password secret # A provider's service
account provider
host smtp.provider.example # Set a default account
account default : gmail
__EOF sudo chmod /etc/msmtprc
sudo chown -R www-data:www-data /etc/msmtprc HOST=$(hostname) sudo mail -vs "Email relaying configured at ${HOST}" $GMAIL_USER <<__EOF
The postfix service has been configured at host '${HOST}'.
Thank you for using this postfix configuration script.
__EOF echo "I have sent you a mail to $GMAIL_USER"
echo "This will confirm that the configuration is good."
echo "Please check your inbox at gmail."

运行完后,将修改用户和组位当前用户(sudo chown xxx:xxx /etc/msmtprc),然后可以将/etc/msmtprc拷贝为~/.msmtprc,此外,记得登陆gmail邮箱,看看是不是存在安全提示

点击"allowing access to less secure apps",然后打开i如下设置:

然后即可以用git send-email提交kernel补丁了:(可以参考王叔叔宋叔叔分享给大家的资料, 或点这里

1、配置git send-email如下(.gitconfig)

[sendemail]
smtpserver = /usr/bin/msmtp

2、生成patch

git format-patch -

比如生成的patch是: 0001-ASoC-compress-Set-reasonable-compress-id-string.patch

如果需要一次生成多个patch的话,使用下面的命令:

git format-patch -s -n --cover-letter --thread

3、检查patch

./scripts/checkpatch.pl -ASoC-compress-Set-reasonable-compress-id-string.patch

4、获得maintainer

./scripts/get_maintainer.pl -ASoC-compress-Set-reasonable-compress-id-string.patch

5、提交

git send-email --to xx@xx --to xx@xx --cc xx@xx --cc xx@xx -ASoC-compress-Set-reasonable-compress-id-string.patch

如果提交的是一些列patch的话,将这些patch在一个git send-email中发送。

完。

Ubuntu下配置用msmtp发送gmail邮件的更多相关文章

  1. Ubuntu 下使用 mutt 和 msmtp 发送 Gmail 邮件

    参考:        http://www.cnblogs.com/refrag/archive/2012/11/28/2793533.html         http://www.habadog. ...

  2. 在命令行上 Ubuntu 下使用 mutt 和 msmtp 发送 Gmail 邮件

    在命令行写email from ubuntu 参考:      http://www.habadog.com/2011/11/23/send-mail-with-msmtp-mutt-linux    ...

  3. WordPress使用PHPMailer发送gmail邮件

    wordpress使用phpmailer发送gmail邮件 0.保证用于gmail账号已经开启imap服务,且你能正常访问到gmail的smtp服务.(需要climb over the wall) 1 ...

  4. Ubuntu下配置python完成爬虫任务(笔记一)

    Ubuntu下配置python完成爬虫任务(笔记一) 目标: 作为一个.NET汪,是时候去学习一下Linux下的操作了.为此选择了python来边学习Linux,边学python,熟能生巧嘛. 前期目 ...

  5. 转[开发环境配置]在Ubuntu下配置舒服的Python开发环境

    在Ubuntu下配置舒服的Python开发环境 Ubuntu 提供了一个良好的 Python 开发环境,但如果想使我们的开发效率最大化,还需要进行很多定制化的安装和配置.下面的是我们团队开发人员推荐的 ...

  6. Ubuntu下配置C/C++开发环境

    在 Ubuntu 下配置 C/C++ 开发环境 转自:白巴的临时空间 Submitted by 白巴 on 2009-04-27 19:52:12. 学习笔记 虽然 Ubuntu 的版本已经是9.04 ...

  7. [转]Ubuntu下配置NFS服务

    [转]Ubuntu下配置NFS服务  http://blog.163.com/liu8821031%40126/blog/static/111782570200921021253516/ Table ...

  8. Ubuntu下配置tftp服务

    Ubuntu下配置tftp服务 1.安装TFTP软件 sudo apt-get install tftp-hpa tftpd-hpa tftp-hpa是客户端,tftpd-hpa是服务器端 2.建立t ...

  9. ubuntu下配置Apache

    ubuntu下配置Apache Apache的默认文档根目录是在Ubuntu上的/var/www目录 配置文件是/ etc/apache2/apache2.conf配置存储在的子目录在/etc/apa ...

随机推荐

  1. 转:Citrix虚拟化--转自CSDN

    http://blog.csdn.net/kkfloat/article/category/1430751/3

  2. PHP中VC6、VC9、TS、NTS版本区别与用法

    1. VC6与VC9的区别: VC6 版本是使用 Visual Studio 6 编译器编译的,如果你的 PHP 是用 Apache 来架设的,那你就选择 VC6 版本.  VC9 版本是使用 Vis ...

  3. MongoDB存储基础教程

    一.MongoDB简介 1. mangodb是一种基于分布式.文件存储的非关系型数据库 2. C++写的,性能高 3. 为web应用提供可扩展的高性能数据存储解决方案 4. 所支持的格式是json格式 ...

  4. JAVA随笔(一)

    数组变量是数组的管理者,而不是拥有者.数组变量的比较,是判断它们是否管理同一个数组.将一个数组变量赋值给 另一个数组变量并不产生新的数组.想产生新的数组只能通过new来完成. 同样,String类型的 ...

  5. 织梦任意页面调用{dede:field.content/}的方法

    过滤掉所有的html代码,只显示文字,具体的ID自己更改. 代码如下: {dede:sql sql='Select content from dede_arctype where id=1'} [fi ...

  6. 【论文阅读】Learning Spatial Regularization with Image-level Supervisions for Multi-label Image Classification

    转载请注明出处:https://www.cnblogs.com/White-xzx/ 原文地址:https://arxiv.org/abs/1702.05891 Caffe-code:https:// ...

  7. Ueditor百度编辑器中的 setContent()方法的使用

    百度编辑器Ueditor所提供的setContent()方法作用是:设置或者改变编辑器里面的文字内容或html内容 函数说明:setContent(string,boolean); 参数string ...

  8. centos 6.8 启动损坏修复实验

    前两天遇到了一个问题,centos必须借助CD的启动才能进入系统,当时想着做个测试,这会儿正好有时间,在VMWare里面试试. 思想是这样的,删除boot里面的文件,然后重启看效果. 具体过程如下: ...

  9. IntelliJ IDEA :Error:(1, 1) java: 非法字符: '\ufeff'

    将file encodings由utf-8改成utf-16,再将utf-16改成utf-8就好了

  10. shell学习(四)

    一.字符截取 expr 基本用法 expr  substr   $var1   起始位置    截取长度,如: [root@localhost mnt]# a=Centos6.9[root@local ...