使用Msmtp mutt shell發郵件

來源:互聯網
上載者:User
使用Msmtp mutt shell發郵件

1、編譯一下軟體

軟體:http://sourceforge.net/projects/msmtp/files/msmtp/1.4.13/msmtp-1.4.13.tar.bz2/download

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 ]#mkdir -p /opt/msmtp/{etc,log}

[root@server ]#cd /opt/msmtp/etc

[root@server etc]# vi 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

user your_account

password your_password

# Set a default account

account default : sohu

儲存退出,並對這個檔案加上可執行許可權:chmod +x msmtprc

到這兒時,最好先測試一下

/opt/msmtp/bin/msmtp test@gmail.com

hello,test

ctrl +d

tail -f /opt/msmtp/log/msmtp.log 看看有沒有成功。

然後再進入到上面的郵件中,看看信收到沒有

4、配置mutt

下載並安裝mutt安裝包:  mutt-1.5.11.tar.gz

tar -xzvf mutt-1.5.11.tar.gz

./configure --prefix=/opt/mutt &&make &&make install

[root@server bin]# vi /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 "messages" test@gmail.com

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.