首页 | 邮件资讯 | 技术教程 | 解决方案 | 产品评测 | 邮件人才 | 邮件博客 | 邮件系统论坛 | 软件下载 | 邮件周刊 | 热点专题 | 工具
网络技术 | 操作系统 | 邮件系统 | 客户端 | 电子邮箱 | 反垃圾邮件 | 邮件安全 | 邮件营销 | 移动电邮 | 邮件软件下载 | 电子书下载

邮件服务器

技术前沿 | Qmail | IMail | MDaemon | Exchange | Domino | 其它 | Foxmail | James | Kerio | JavaMail | WinMail | Sendmail | Postfix | Winwebmail | Merak | CMailServer | 邮件与开发 | 金笛 |
首页 > 邮件服务器 > Sendmail > sendmail中.forward文件的注意事项 > 正文

sendmail中.forward文件的注意事项

出处:pengcz 作者:pengcz 时间:2010-1-19 9:56:45

sendmail中如果非root用户想实现邮件转发功能,可以通过.forward文件来实现,这个文件是放在用户主目录下的

如用户peter的主目录是/home/peter

[peter@station11 ~]$ cat /home/peter/.forward
test
\peter
[peter@station11 ~]$
如果邮件的转发同时要转发给本身一份,则需要在用户名前添加一个\代表取消转发,免得无限循环下去呵!

清空maillog记录

[root@station11 ~]# > /var/log/maillog

发测试邮件
[root@station11 ~]# ls  -l | mail -s "test .forward file function " peter@station11.example.com

检查mail的log信息
[root@station11 ~]# cat /var/log/maillog
Jan  2 14:10:42 station11 sendmail[26665]: o02MAg5a026665: from=root, size=303, class=0, nrcpts=1, msgid=<201001022210.o02MAg5a026665@station11.example.com>, relay=root@localhost
Jan  2 14:10:42 station11 sendmail[26666]: o02MAgIw026666: from=<root@station11.example.com>, size=609, class=0, nrcpts=1, msgid=<201001022210.o02MAg5a026665@station11.example.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Jan  2 14:10:42 station11 sendmail[26665]: o02MAg5a026665: to=peter@station11.example.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30303, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o02MAgIw026666 Message accepted for delivery)
Jan  2 14:10:42 station11 sendmail[26667]: o02MAgIw026666: to=test, ctladdr=<root@station11.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=60847, dsn=2.0.0, stat=Sent
Jan  2 14:10:42 station11 sendmail[26667]: o02MAgIw026666: to=\\peter, ctladdr=<root@station11.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=60847, dsn=2.0.0, stat=Sent
[root@station11 ~]#

 

看maillog日志格式:

时间戳++++++++主机名(这里是station11)++++++++服务器软件名++++to=发送给谁++++ctladdr=谁发的邮件stat=Send说明邮件已发送出去,但不保证对端收到呵,但能说明本端服务配置基本是正常的

还有一种方法是查mailq,mailq显示出站邮件队列,如果 报告队列中有消息则说明本地或者远程配置或者网络有问题呵!自己给自己发邮件则说明本地配置有问题了

[root@station11 mqueue]# mailq
/var/spool/mqueue is empty
                Total requests: 0

 

这时要说明的是一个权限问题,.forward文件只允许属主有写权限,其他不能有写要限

[root@station11 ~]# ls /home/peter/.forward -l
-rwxrwxr-x 1 peter peter 12 Jan  1 15:06 /home/peter/.forward
[root@station11 ~]# > /var/log/maillog
[root@station11 ~]# ls -l | mail -s "test .forward permission " peter
[root@station11 ~]# mailq
/var/spool/mqueue is empty
                Total requests: 0
[root@station11 ~]# su - test
[test@station11 ~]$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/test": 2 messages 1 new 2 unread
 U  1 root@station11.examp  Fri Jan  1 15:22  20/722   "test ls command 2"
>N  2 root@station11.examp  Sat Jan  2 14:10  20/921   "test .forward file function"
& q
Held 2 messages in /var/spool/mail/test
[test@station11 ~]$ su - peter
Password:
[peter@station11 ~]$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/peter": 3 messages 2 new 3 unread
 U  1 root@station11.examp  Fri Jan  1 15:06  20/722   "test ls command 1"
>N  2 root@station11.examp  Sat Jan  2 14:10  20/921   "test .forward file function"
 N  3 root@station11.examp  Sat Jan  2 14:36  20/896   "test .forward permission"
& q
Held 3 messages in /var/spool/mail/peter
[peter@station11 ~]$ exit
logout
[test@station11 ~]$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/test": 2 messages 2 unread
>U  1 root@station11.examp  Fri Jan  1 15:22  20/722   "test ls command 2"
 U  2 root@station11.examp  Sat Jan  2 14:10  21/931   "test .forward file function"
& q
Held 2 messages in /var/spool/mail/test
[test@station11 ~]$ exit
logout
[root@station11 ~]# cat /var/log/maillog
Jan  2 14:36:05 station11 sendmail[27438]: o02Ma5sj027438: from=root, size=278, class=0, nrcpts=1, msgid=<201001022236.o02Ma5sj027438@station11.example.com>, relay=root@localhost
Jan  2 14:36:05 station11 sendmail[27439]: o02Ma5SB027439: from=<root@station11.example.com>, size=584, class=0, nrcpts=1, msgid=<201001022236.o02Ma5sj027438@station11.example.com>, proto=ESMTP, daemon=MTA, relay=localhost.localdomain [127.0.0.1]
Jan  2 14:36:05 station11 sendmail[27440]: o02Ma5SB027439: forward /home/peter/.forward: Group writable file                         <===test用户收不到邮件的原因在这里
Jan  2 14:36:05 station11 sendmail[27438]: o02Ma5sj027438: to=peter, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30278, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o02Ma5SB027439 Message accepted for delivery)
Jan  2 14:36:05 station11 sendmail[27440]: o02Ma5SB027439: to=<peter@station11.example.com>, ctladdr=<root@station11.example.com> (0/0), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=30822, dsn=2.0.0, stat=Sent
[root@station11 ~]#

 

 

下面是更新了权限后,test用户很书就收到邮件,注意邮件标题呵!

[root@station11 ~]# chmod 700 /home/peter/.forward
[root@station11 ~]#
[root@station11 ~]#
[root@station11 ~]#
[root@station11 ~]# > /var/log/maillog
[root@station11 ~]# ls -l | mail -s "test .forward permission XXXXXXXXXXXXXX " peter
[root@station11 ~]# su - test
[test@station11 ~]$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/test": 3 messages 1 new 3 unread
 U  1 root@station11.examp  Fri Jan  1 15:22  20/722   "test ls command 2"
 U  2 root@station11.examp  Sat Jan  2 14:10  21/931   "test .forward file function"
>N  3 root@station11.examp  Sat Jan  2 14:38  20/911   "test .forward permission XXXXXXXXXXXXXX"
& q
Held 3 messages in /var/spool/mail/test
[test@station11 ~]$

相关文章 热门文章
  • Linux启动 Sendmail速度慢的解决办法
  • RHEL5.2 sendmail和openwebmail 、dpvecpt 配置总结
  • PEAR Mail软件包Sendmail Mail::Send()方式参数注入漏洞
  • Linux启动sendmail速度慢的解决办法
  • 为Sendmail添加邮件认证功能
  • FYI:商用Sendmail的安全和隔离要点
  • 在Perl和Sendmail的附件做过滤系统
  • sendmail做smtp SERVER
  • Sendmail Analyzer 5.3 发布
  • 如何限制Sendmail下邮件的大小
  • Fedora架设Sendmail邮件服务器
  • 19.3.2 开放SendMail的监听接口与设置收信主机名称
  • Sendmail8.12.9+RedHat 8.0建构邮件服务器
  • sendmail大全
  • Sendmail邮件服务器快速指南
  • SendMail上手指南
  • 用Sendmail配置你的第一台e-mail服务器
  • RedHatLinux AS3中SendMail的配置
  • 企业Sendmail邮件服务器的创建
  • Sendmail环境下对抗垃圾邮件的处理方法
  • Sendmail的邮件用户与系统用户分离
  • 我的qmail安装历程
  • 带SMTP认证功能的sendmail配置
  • Sendmail的relay用法汇总
  • 自由广告区
     
    最新软件下载
  • SharePoint Server 2010 部署文档
  • Exchange 2010 RTM升级至SP1 教程
  • Exchange 2010 OWA下RBAC实现的组功能...
  • Lync Server 2010 Standard Edition 标..
  • Lync Server 2010 Enterprise Edition...
  • Forefront Endpoint Protection 2010 ...
  • Lync Server 2010 Edge 服务器部署文档
  • 《Exchange 2003专家指南》
  • Mastering Hyper-V Deployment
  • Windows Server 2008 R2 Hyper-V
  • Microsoft Lync Server 2010 Unleashed
  • Windows Server 2008 R2 Unleashed
  • 今日邮件技术文章
  • 腾讯,在创新中演绎互联网“进化论”
  • 华科人 张小龙 (中国第二代程序员 QQ...
  • 微软推出新功能 提高Hotmail密码安全性
  • 快压技巧分享:秒传邮件超大附件
  • 不容忽视的邮件营销数据分析过程中的算..
  • 国内手机邮箱的现状与未来发展——访尚..
  • 易观数据:2011Q2中国手机邮箱市场收入..
  • 穿越时空的爱恋 QQ邮箱音视频及贺卡邮件
  • Hotmail新功能:“我的朋友可能被黑了”
  • 入侵邻居网络发骚扰邮件 美国男子被重..
  • 网易邮箱莫子睿:《非你莫属》招聘多过..
  • 中国电信推广189邮箱绿色账单
  • 最新专题
  • 鸟哥的Linux私房菜之Mail服务器
  • Exchange Server 2010技术专题
  • Windows 7 技术专题
  • Sendmail 邮件系统配置
  • 组建Exchange 2003邮件系统
  • Windows Server 2008 专题
  • ORF 反垃圾邮件系统
  • Exchange Server 2007 专题
  • ISA Server 2006 教程专题
  • Windows Vista 技术专题
  • “黑莓”(BlackBerry)专题
  • Apache James 专题
  • 分类导航
    邮件新闻资讯:
    IT业界 | 邮件服务器 | 邮件趣闻 | 移动电邮
    电子邮箱 | 反垃圾邮件|邮件客户端|网络安全
    行业数据 | 邮件人物 | 网站公告 | 行业法规
    网络技术:
    邮件原理 | 网络协议 | 网络管理 | 传输介质
    线路接入 | 路由接口 | 邮件存储 | 华为3Com
    CISCO技术 | 网络与服务器硬件
    操作系统:
    Windows 9X | Linux&Uinx | Windows NT
    Windows Vista | FreeBSD | 其它操作系统
    邮件服务器:
    程序与开发 | Exchange | Qmail | Postfix
    Sendmail | MDaemon | Domino | Foxmail
    KerioMail | JavaMail | Winwebmail |James
    Merak&VisNetic | CMailServer | WinMail
    金笛邮件系统 | 其它 |
    反垃圾邮件:
    综述| 客户端反垃圾邮件|服务器端反垃圾邮件
    邮件客户端软件:
    Outlook | Foxmail | DreamMail| KooMail
    The bat | 雷鸟 | Eudora |Becky! |Pegasus
    IncrediMail |其它
    电子邮箱: 个人邮箱 | 企业邮箱 |Gmail
    移动电子邮件:服务器 | 客户端 | 技术前沿
    邮件网络安全:
    软件漏洞 | 安全知识 | 病毒公告 |防火墙
    攻防技术 | 病毒查杀| ISA | 数字签名
    邮件营销:
    Email营销 | 网络营销 | 营销技巧 |营销案例
    邮件人才:招聘 | 职场 | 培训 | 指南 | 职场
    解决方案:
    邮件系统|反垃圾邮件 |安全 |移动电邮 |招标
    产品评测:
    邮件系统 |反垃圾邮件 |邮箱 |安全 |客户端
    广告联系 | 合作联系 | 关于我们 | 联系我们 | 繁體中文
    版权所有:邮件技术资讯网©2003-2010 www.5dmail.net, All Rights Reserved
    www.5Dmail.net Web Team   粤ICP备05009143号