免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1038 | 回复: 0
打印 上一主题 下一主题

又一招:使用msmtp+mutt+shell发邮件 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-12-16 16:38 |只看该作者 |倒序浏览
    今天在宿舍没事做,又实在无聊,只好研究些东西,打开电脑发现好久之前下载的msmtp一直没有研究下,呵呵,因为我已经使用perl搞定我的事情了,不过呢,多一种解决方法也好。开工,解决一下
1、编译一下软件
tar jxvf msmtp-1.4.13.tar.bz2
./configure --prefix=/opt/msmtp
make
make install

2、查看配置文件在那儿
[root@server bin]# ./msmtp --version
msmtp version 1.4.13
TLS/SSL library: none
Authentication library: built-in
Supported authentication methods:
plain cram-md5 external login
IDN support: disabled
NLS: enabled, LOCALEDIR is /opt/msmtop/share/locale
System configuration file name: /opt/msmtp/etc/msmtprc -----呵呵,这是我自己建的
User configuration file name: /root/.msmtprc
Copyright (C) 2007 Martin Lambers and others.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License .
There is NO WARRANTY, to the extent permitted by law.

3、配置一下msmtp的配置文件
[root@server etc]# more msmtprc
# Set default values for all following accounts.
defaults
logfile /opt/msmtp/log/msmtp.log        -------该文件要存在,不然没有日志
# The SMTP server of the provider.
account sohu
host smtp.sohu.com
from
your_account@sohu.com
auth login                               -------这个要为login,好像on不行
user your_account
password your_password
# Set a default account
account default : sohu
    到这儿时,最好先测试一下
   /opt/msmtp/bin/msmtp
yehaozi@gmail.com
   hello,test
   ctrl+d
   tail -f /opt/msmtp/log/msmtp.log 看看有没有成功。
   然后再进入到上面的邮件中,看看信收到没有

4、配置mutt
   我原来在网上一直看到mutt+msmtp发送邮件,我不想装mutt。(汗啊,后面才发现系统已经装了)。一直在找怎么使用msmtp自己来发邮件,邮件可以发,不过功能实在是太少了。那就用已经安装好了的mutt.
[root@server bin]# tail -5 /etc/Muttrc
set sendmail="/opt/msmtp/bin/msmtp"                 
set realname="actor"
set use_from=yes
set editor="vi"

5、现在都已经搞定了,开始测试看看
[root@server bin]# echo "测试一下" | mutt -s "管理信息"
yehaozi@gmail.com


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/55457/showart_443605.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP