Centos下安装mailx,Centos安装mailx下载mailx包ma


[root@localhost /]# mail -s "Message" xxxxx@163.com < /tmp/info.message

系统默认以“root@主机名” 发送邮件,收到邮件直接被过虑成垃圾邮件了,那可不可以自定义邮箱发送邮件呢?

答案肯定可以的。

下载mailx包

mailx官方站点 http://heirloom.sourceforge.net/

下载最新版本mailx-12.4.tar.bz2 (271.5 kB)

http://sourceforge.net/projects/heirloom/files/latest/download?source=files

[root@localhostsoftware]#tar-jxvfmailx-12.4.tar.bz2

[root@localhostsoftware]#cdmailx-12.4

[root@localhostmailx-12.4]#make

openssl.c:108:错误:expecteddeclarationspecifiersor‘...’before‘STACK’

openssl.c:在函数‘ssl_select_method’中:

openssl.c:215:警告:赋值丢弃了指针目标类型的限定

openssl.c:217:警告:赋值丢弃了指针目标类型的限定

openssl.c:219:警告:赋值丢弃了指针目标类型的限定

openssl.c:223:警告:赋值丢弃了指针目标类型的限定

openssl.c:226:警告:赋值丢弃了指针目标类型的限定

openssl.c:在函数‘ssl_check_host’中:

openssl.c:311:错误:‘STACK’未声明(在此函数内第一次使用)

openssl.c:311:错误:(即使在一个函数内多次出现,每个未声明的标识符在其

openssl.c:311:错误:所在的函数内也只报告一次。)

openssl.c:311:错误:‘gens’未声明(在此函数内第一次使用)

openssl.c:在文件层:

openssl.c:499:错误:expecteddeclarationspecifiersor‘...’before‘STACK’

openssl.c:在函数‘smime_verify’中:

openssl.c:508:错误:‘STACK’未声明(在此函数内第一次使用)

openssl.c:508:错误:‘certs’未声明(在此函数内第一次使用)

openssl.c:508:错误:‘gens’未声明(在此函数内第一次使用)

openssl.c:555:错误:‘chain’未声明(在此函数内第一次使用)

openssl.c:在函数‘cverify’中:

openssl.c:617:错误:‘STACK’未声明(在此函数内第一次使用)

openssl.c:617:错误:‘chain’未声明(在此函数内第一次使用)

openssl.c:649:错误:提供给函数‘smime_verify’的实参太多

openssl.c:在函数‘smime_encrypt’中:

openssl.c:690:错误:‘STACK’未声明(在此函数内第一次使用)

openssl.c:690:错误:‘certs’未声明(在此函数内第一次使用)

openssl.c:在函数‘smime_certsave’中:

openssl.c:953:错误:‘STACK’未声明(在此函数内第一次使用)

openssl.c:953:错误:‘certs’未声明(在此函数内第一次使用)

openssl.c:955:错误:‘chain’未声明(在此函数内第一次使用)

Makefile:80:recipefortarget'openssl.o'failed

make:***[openssl.o]Error1

出现错误,看下面文档帮助

http://www.linuxfromscratch.org/blfs/view/stable/basicnet/mailx.html

原来差补丁,修复他

[root@localhostmailx-12.4]#wgethttp://www.linuxfromscratch.org/patches/blfs/7.6/mailx-12.4-openssl_1.0.0_build_fix-1.patch

[root@localhostmailx-12.4]#patch-Np1-imailx-12.4-openssl_1.0.0_build_fix-1.patch

patchingfilemakeconfig

patchingfileopenssl.c

#修复补丁成功

[root@localhostmailx-12.4]#makeclean#清除历史编译后文件

[root@localhostmailx-12.4]#make#再次编绎

[root@localhostmailx-12.4]#makeinstallUCBINSTALL=/usr/bin/install

/usr/bin/install-cmailx/usr/local/bin/mailx

strip/usr/local/bin/mailx

test-d/usr/local/share/man/man1||mkdir-p/usr/local/share/man/man1

/usr/bin/install-c-m644mailx.1/usr/local/share/man/man1/mailx.1

test-d/etc||mkdir-p/etc

test-f/etc/nail.rc||

/usr/bin/install-c-m644nail.rc/etc/nail.rc

[root@localhostbin]#vim/etc/nail.rc#编辑nail.rc配置外部SMTP信息

setfrom=xxxx@163.comsmtp=smtp.163.com

setsmtp-auth-user=xxxxx@163.comsmtp-auth-password=xxxxxsmtp-auth=login

[root@localhostmailx-12.4]#servicepostfixreload#重新加载postfix,可以不用重启的。

测试一下

[root@localhostmailx-12.4]#mail-s"Message"xxxxx@163.com</tmp/info.message

邮件发送成功,但为什么收到的还是root@localhost.xx发送的邮件呢?

[root@localhostmailx-12.4]#whereismailx

mailx:/bin/mailx/usr/bin/mailx/usr/local/bin/mailx/usr/share/man/man1/mailx.1/usr/share/man/man1/mailx.1.gz/usr/share/man/man1p/mailx.1p.gz

哦,原因是新安装的包没有生效,执行还是原来的路径,替换他。

[root@localhostmailx-12.4]#cd/bin

[root@localhostbin]#rm-rfmailx

[root@localhostbin]#ln-s/usr/local/bin/mailxmailx

[root@localhostbin]#mailx-V

[root@localhostbin]#mail-s"Message"xxxxx@163.com</tmp/info.message

这下成功。

其它方法如:SendEmail 见http://caspian.dotconf.net/menu/Software/SendEmail/

相关内容

    暂无相关文章