歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> Centos下安裝mailx

Centos下安裝mailx

日期:2017/3/3 17:24:43   编辑:學習Linux

Centos下安裝mailx


熱度5 評論 72 www.BkJia.Com 網友分享於: 2017-02-28 06:02:19 浏覽數42344次

Centos下安裝mailx


[root@localhost /]# mail -s "Message" [email protected] < /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[[email protected]]#makeopenssl.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'failedmake:***[openssl.o]Error1

出現錯誤,看下面文檔幫助

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

原來差補丁,修復他

[[email protected]]#wgethttp://www.linuxfromscratch.org/patches/blfs/7.6/mailx-12.4-openssl_1.0.0_build_fix-1.patch[[email protected]]#patch-Np1-imailx-12.4-openssl_1.0.0_build_fix-1.patchpatchingfilemakeconfigpatchingfileopenssl.c

#修復補丁成功

[[email protected]]#makeclean#清除歷史編譯後文件[[email protected]]#make#再次編繹[[email protected]]#makeinstallUCBINSTALL=/usr/bin/install/usr/bin/install-cmailx/usr/local/bin/mailxstrip/usr/local/bin/mailxtest-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.1test-d/etc||mkdir-p/etctest-f/etc/nail.rc||\/usr/bin/install-c-m644nail.rc/etc/nail.rc[root@localhostbin]#vim/etc/nail.rc#編輯nail.rc配置外部SMTP信息set[email protected]=smtp.163.comset[email protected]=xxxxxsmtp-auth=login[[email protected]]#servicepostfixreload#重新加載postfix,可以不用重啟的。

測試一下

[[email protected]]#mail-s"Message"[email protected]</tmp/info.message

郵件發送成功,但為什麼收到的還是[email protected]發送的郵件呢?

[[email protected]]#whereismailxmailx:/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

哦,原因是新安裝的包沒有生效,執行還是原來的路徑,替換他。

[[email protected]]#cd/bin[root@localhostbin]#rm-rfmailx[root@localhostbin]#ln-s/usr/local/bin/mailxmailx[root@localhostbin]#mailx-V[root@localhostbin]#mail-s"Message"[email protected]</tmp/info.message

這下成功。

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

http://www.bkjia.com/Linuxjc/1196000.htmlwww.bkjia.comtrue

Copyright © Linux教程網 All Rights Reserved