命令行中发送Gmail 邮件,大家快去试试吧(教程)
命令行里面用gmail发邮件的方法终于搞出来了, 哈哈,下面只说简单必要的步骤
1. 须要两个软件 msmtp 和heirloom-mailx
# aptitude install msmtp heirloom-mailx
2. 希望你的ubuntu 下有 /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt 这个文件
3. 建立 ~/.msmtprc
# Gmail account starts
# account name which must be unique for each account
account gmail1
auth on
#Gmail SMTP host name
host smtp.
port 587
#sets Transport Layer Security on
tls on
# location of tls certificate file for Gmail (change this parameter if your certificate file is stored at some other location in your File-system)
tls_trust_file /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt
#your email id here (e.g. abc@)
user YOUR_EMAIL_ID
#your password here
password YOUR_PASSWORD
#email id of the sender that is you again
from YOUR_EMAIL_ID
# Gmail account end
#So we have added one account. Similarly we can add more accounts by repeating and modifying
#above code for each new account. Make sure you give unique name to each account.
#set default account to be used when no account is specified (Not necessary for single account)
account default: gmail1
复制粘贴,大写字母的三个地方修改一下,
4. 改一下权限
$ chmod 600 ~/.msmtprc
5. 再建立一个文件 ~/.mailrc
set from="YOUR_EMAIL_ID" #your email id here
set sendmail="/usr/bin/msmtp" #location of msmtp's binary executable
set message-sendmail-extra-arguments="-a gmail1"
#additional arguments to msmtp goes here (optional) (-a indicates account name to be used to send mails)
复制粘贴, 大写字母的地方改一下
6. 好了,可以发在命令行发邮件了
$ mailx ***@*** 这是我的手机地址,接受骚扰
会提示主题
写玩内容后按Ctrl-D 发送, 成功了吧,功了吧,了吧,吧~~~~
[ 本帖最后由 madfrogme 于 2012-11-1 18:48 编辑 ]