Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using msmtp + mutt to send mail under Linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Use mutt to send mail under Linux

1. Root user execution

Sudo apt-get install msmtp

Sudo yum-y install msmtp

Sudo yum-y install mutt

Wget http://downloads.sourceforge.net/msmtp/msmtp-1.4.30.tar.bz2?big_mirror=0

Tar-jxvf msmtp-1.4.30.tar.bz2

Cd msmtp-1.4.30

. / configure-- prefix=/usr/local/msmtp

Make

Make install

Chmod-R 755 / usr/local/msmtp

Ln-s / usr/local/msmtp/bin/msmtp / usr/bin/msmtp

Setting profile under ordinary users

Vi / .msmtprc

Account default

Host outgoing mail server name

Port 25

From sender

Auth plain

User sender email account

Password sender email password

Logfile ~ / .msmtp.log log location

[xxxxxxx@vmcxapk01 ~] $cat .msmtprc

Account default

Host smtp.richinfo.cn

Port 25

From xxxxxxx@richinfo.cn

Auth login

Tls off

User xxxxxxx@richinfo.cn

Password # @ #

Logfile / .msmtp.log

Vi / .muttrc

Set sendmail= "/ usr/bin/msmtp" msmtp # installation location, soft connection made in advance (can be obtained using which msmtp)

Set use_from=yes

Name of sender of set realname= "XX"

Set from= "XX" sender email account

Set envelope_from=yes

Set editor= "vim-nw"

[xxxxxxx@vmcxapk01 ~] $cat .muttrc

Set sendmail= "/ usr/bin/msmtp"

Set charset= "UTF-8" # set the code

Set rfc2047_parameters=yes

Set envelope_from=yes

Set use_from=yes

Set from= "xxxxxxx@richinfo.cn"

Set realname= "$HOSTNAME" # it's best to change your email account name to prevent it from being mistaken for spam

Modify permissions for .muttrc

Sudo chmod 0600 ~ / .msmtprc

Otherwise, it will prompt:

".msmtprc: contains secrets and therefore must have no more than user read/write permissions"

Send an email

Echo "test" | mutt-s "test" XX@richinfo.cn

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report