Ubuntu下配置用msmtp发送gmail邮件
从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邮件的更多相关文章
- Ubuntu 下使用 mutt 和 msmtp 发送 Gmail 邮件
参考: http://www.cnblogs.com/refrag/archive/2012/11/28/2793533.html http://www.habadog. ...
- 在命令行上 Ubuntu 下使用 mutt 和 msmtp 发送 Gmail 邮件
在命令行写email from ubuntu 参考: http://www.habadog.com/2011/11/23/send-mail-with-msmtp-mutt-linux ...
- WordPress使用PHPMailer发送gmail邮件
wordpress使用phpmailer发送gmail邮件 0.保证用于gmail账号已经开启imap服务,且你能正常访问到gmail的smtp服务.(需要climb over the wall) 1 ...
- Ubuntu下配置python完成爬虫任务(笔记一)
Ubuntu下配置python完成爬虫任务(笔记一) 目标: 作为一个.NET汪,是时候去学习一下Linux下的操作了.为此选择了python来边学习Linux,边学python,熟能生巧嘛. 前期目 ...
- 转[开发环境配置]在Ubuntu下配置舒服的Python开发环境
在Ubuntu下配置舒服的Python开发环境 Ubuntu 提供了一个良好的 Python 开发环境,但如果想使我们的开发效率最大化,还需要进行很多定制化的安装和配置.下面的是我们团队开发人员推荐的 ...
- Ubuntu下配置C/C++开发环境
在 Ubuntu 下配置 C/C++ 开发环境 转自:白巴的临时空间 Submitted by 白巴 on 2009-04-27 19:52:12. 学习笔记 虽然 Ubuntu 的版本已经是9.04 ...
- [转]Ubuntu下配置NFS服务
[转]Ubuntu下配置NFS服务 http://blog.163.com/liu8821031%40126/blog/static/111782570200921021253516/ Table ...
- Ubuntu下配置tftp服务
Ubuntu下配置tftp服务 1.安装TFTP软件 sudo apt-get install tftp-hpa tftpd-hpa tftp-hpa是客户端,tftpd-hpa是服务器端 2.建立t ...
- ubuntu下配置Apache
ubuntu下配置Apache Apache的默认文档根目录是在Ubuntu上的/var/www目录 配置文件是/ etc/apache2/apache2.conf配置存储在的子目录在/etc/apa ...
随机推荐
- CodeForces Contest #1110: Global Round 1
比赛传送门:CF #1110. 比赛记录:点我. 涨了挺多分,希望下次还能涨. [A]Parity 题意简述: 问 \(k\) 位 \(b\) 进制数 \(\overline{a_1a_2\cdots ...
- Python-Analysis-Malware
Python恶意软件分析应用-PEfile 0x1.前言 要想对恶意代码快速分析,Python是一门必须要掌握的编程技能.因为它是跨平台的,而且容易阅读和编写.许多开源安全工具也是用Python写的. ...
- if语句引起的bug
最近维护高手留下的api项目,客户端反馈一个bug过来,然后查找到可能出错的代码位置,是一个if语句,乍一看好像没什么问题,代码如下: if (company.UserId != userId || ...
- Linux内核入门(六)—— __attribute__ 机制【转】
转自:https://blog.csdn.net/yunsongice/article/details/5538020 GNU C的一大特色(却不被初学者所知)就是__attribute__机制.__ ...
- VUE之搭建脚手架
原文转自http://blog.csdn.net/Shiyaru1314/article/details/54963027 目录(?)[-] 1 安装之前需要检查是否已经安装NodeJS的环境 安装文 ...
- 在内部局域网内搭建HTTPs
在内部局域网内搭建HTTPs 配置环境 Windows版本:Windows Server 2008 R2 Standard Service Pack 1 系统类型: 64 位操作系统 内存 ...
- MySQL 数据库性能优化之SQL优化【转】
优化目标 减少 IO 次数IO永远是数据库最容易瓶颈的地方,这是由数据库的职责所决定的,大部分数据库操作中超过90%的时间都是 IO 操作所占用的,减少 IO 次数是 SQL 优化中需要第一优先考虑, ...
- bzoj 1150
思路:写的时候感觉是贪心但是没有什么思路... 看了题解,原来有一个选了能反悔的贪心思路, 如果最优那么每个城市只能和旁边的相邻 城市连边,所以问题变成了由n个数,不能取相邻的两个数,取k个最小是多少 ...
- Spring中AOP实现
1.什么是SpringAOP 什么是aop:Aspect Oriented Programming的缩写,面向切面编程,通过预编译和动态代理实现程序功能的 统一维护的一种技术 主要功能:日志记录,性能 ...
- Centos下命令行编译MapReduce代码(Java)并打包在Hadoop中执行
前提条件:搭建好Hadoop系统 新建文件夹:input 和 output hdfs dfs -mkdir /inputhdfs dfs -mkdir /output 查看文件系统 hdfs df ...