HP-UX和Solaris還有Redhat發(fā)郵件的命令各有千秋.
solaris
# /usr/ucb/mail test@163.com < w.tx
Linux發(fā)郵件只要在命令行輸入
#mail -s "test" test@163.com < w.tx
下面詳細(xì)介紹HP-UX sendmail設(shè)置.
1.root登陸
2.修改/etc/hosts文件
# vi /etc/hosts
添加企業(yè)內(nèi)部SMTP郵件代理服務(wù)器的IP解析
192.168.0.121 hpmail hpux.com
3.生成mail控制文件
如果存在/etc/nsswitch.conf ,那么直接修改該文件;如果不存在,則需要拷貝一個(gè):
#cp -p /usr/newconfig/etc/nsswitch.files /etc/nsswitch.conf
#vi /etc/nsswitch.conf
確定有如下一行
hosts: files
4.測(cè)試解析
#nslookup
Using /etc/hosts on : hosta
>hpmail
沒問題的話,繼續(xù);有問題則看看自己上面做對(duì)了沒有。
5.修改mail配置文件
#vi /etc/mail/sendmail.cf
找到:#Dj$w.Foo.COM 這行,并在下面增加一行:
Dj$w.dbinfo (發(fā)送郵件時(shí),系統(tǒng)默認(rèn)發(fā)信人是:root@hostname.dbinfo)
然后,找到DS 行,改成:
DS hpmail
存檔退出
6.測(cè)試
#/sbin/init.d/sendmail stop
#/sbin/init.d/sendmail start
#sendmail test@163.com < w.txt
#sendmail -v test@163.com
<輸入郵件內(nèi)容>
.
例如:
#>sendmail -v test@163.com
test
.
test@163.com... Connecting to mail1 via relay...
……
7.發(fā)送測(cè)試郵件
# mailx -s "test"test@163.com
8.發(fā)送文本郵件
# mailx -s "ALERT_LOG_ERROR"test@163.com<$file_dir/$error_file_name
9.發(fā)送帶附件的郵件
# uuencode $file_dir/$error_file_name $file_name | mailx -m -s $title test@163.com