您的位置:首页 > 编程语言 > PHP开发

ubuntu下终端邮件客户端msmtp

2010-11-03 15:19 239 查看
1、安装

sudo apt-get install msmtp

2、查看配置文件路径

huyuke@huyuke:~$ msmtp –version

msmtp version 1.4.19

TLS/SSL library: GnuTLS

Authentication library: GNU SASL

Supported authentication methods:

plain cram-md5 digest-md5 gssapi external login ntlm

IDN support: enabled

NLS: enabled, LOCALEDIR is /usr/share/locale

Keyring support: none

System configuration file name: /etc/msmtprc

User configuration file name: /home/git/.msmtprc

Copyright (C) 2009 Martin Lambers and others.

This is free software. You may redistribute copies of it under the terms of

the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.

There is NO WARRANTY, to the extent permitted by law.

3、配置一下msmtp的配置文件

huyuke@huyuke:~$ sudo vim /etc/msmtprc

# Set default values for all following accounts.

defaults

logfile /home/huyuke/msmtp.log #需要新建该文件记录日志

# The SMTP server of the provider.

account huyuke

host SMTP服务器

from 用来发送邮件的email地址

auth login

user 邮件帐户

password 邮件帐户密码

# Set a default account

account default : huyuke

测试一下发送邮件

huyuke@huyuke:~$ msmtp yuke.hu@hotmail.com

TEST by msmtp

ctrl+d #退出编辑并发送

huyuke@huyuke:~$ tail -f msmtp.log 看看有没有成功。

然后再进入到上面的邮件中,看看信收到没有

然后配置做个/usr/bin/msmtp到/usr/sbin/sendmail的符号链接也可以

4、应用举例


在设置好配置文件后,就可以在命令行下用msmtp发送邮件

在shell下运行命令:msmtp -t #这里用 -t 来指定收件人。由于msmtp要从标准输入中读取邮件,因此回车后,进入输入方式,下面接着输入:

to: xxxx@server.com #设定收件人,以便让 -t 参数生效

subject: test #设定主题

#空行

test smtp

ctrl+D结束
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: