In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Use the mail command
The mail command is part of the mailutils (On Debian) or mailx (On RedHat) package, which we can use to send messages on the command line.
If your system does not have the mail command installed, you can install it in the following ways:
$sudo apt-get install mailutils (On Debian)
# yum install mailx (On RedHat or CentOS)
Now let's use the mail command to send an email with an attachment, as follows:
Echo "enter your email content here" | mail-s "email title"-a file.txt 59090939@qq.com
Of course, we can save the contents of the message to a file, such as the following: we store the contents of the message in a message.txt file and send it:
Mail-s "email title"-a file.txt 59090939@qq.com
< message.txt 这时候的message.txt是以文本内容在邮件中显示的,并不是以附件的形式。 我们在发送附件的时候出现下面的错误: send-mail: fatal: xiao(40010): message file too big 从上面的错误信息可以看出,我们发送的附件太大了,我们可以通过以下两种方法来加大附件大小的限制: 第一种: [root@xiao ~]$ postconf message_size_limit message_size_limit = 51200000 echo "message_size_limit = 102400000" >> / etc/postfix/main.cf & & service postfix reload
Reloading Postfix configuration...done.
The second kind:
[root@xiao] $postconf-e message_size_limit=302400000
[root@xiao ~] $service postfix restart
Shutting down postfix: [OK]
Starting postfix: [OK]
[root@xiao ~] $postconf message_size_limit
Message_size_limit = 302400000
Both methods can be set
Configure mailbox account
Vi / etc/mail.rc adds one of the following two paragraphs at the end of the document. The first paragraph is generally fine for domestic IP, and the second paragraph is used for some foreign IP, which has a higher security level.
Set from=59090939@qq.com
Set smtp= "smtp.qq.com"
Set smtp-auth-user= "59090939@qq.com"
Set smtp-auth-password= "ttvingav"
Set smtp-auth=login
Or
Set from=59090939@qq.com
Set smtp= "smtp.qq.com:587"
Set smtp-auth-user= "59090939@qq.com"
Set smtp-auth-password= "ttvingavu"
Set smtp-auth=login
Set smtp-use-starttls
Set nss-config-dir=/etc/openldap/certs
Use the mutt command
Mutt is a popular lightweight email client command, http://www.mutt.org/
We can also use it to send mail with attachments. If this command is not installed on your computer, please use the following command to install it:
$sudo apt-get install mutt
# yum install mutt
Source code installation
Wget ftp://ftp.mutt.org/pub/mutt/mutt-1.11.2.tar.gz
Tar-zvxf mutt-1.11.2
Cd mutt-1.11.2
. / configure-prefix=/usr/local/mutt-enable-pop-enable-smtp-with-ssl-with-sasl
-- enable-pop enables pop
-- enable-smtp enables smtp
-- with-ssl-- with-sasl must use more secure encryption when the above protocol is enabled
Installation
Make & & make install
Because the test account is QQ mail, qq mail requires a ssl secure connection when using the smtp protocol, while a secure connection is used in mutt
Sasl encryption is also required, so the above two security components have to be added when compiling and installing. Otherwise, when you send an e-mail,
"SMTP authentication requires SASL" or another error related to ssl occurred
Add the following at the end of the configuration mailbox account vi / etc/Muttrc file
Set use_from=yes
Set use_envelope_from=yes
Set realname= "59090939"
Set from= "59090939@qq.com"
Set smtp_pass= "ttvingavu"
Set smtp_url= "smtps://59090939@smtp.qq.com:465/"
If port 465 is used in China, the error will be reported as follows when using 587:
Gnutls_handshake: an unexpected TLS packet was received.
Unable to send this letter
Now we can use the mutt command to send mail with attachments:
Echo "enter your email content here" | mutt-s "email title"-a file.txt 59090939@qq.com
As you can see from the above, the use of mutt is very similar to the mail command, and more about its usage parameters can be viewed directly by man mutt.
Use msmtp
Cloud installation
$sudo apt-get install msmtp
# yum install mstp
Installation in source mode
Https://marlam.de/msmtp/
Wget https://marlam.de/msmtp/releases/msmtp-1.8.1.tar.xz
Xz-d msmtp-1.8.1.tar.xz
Tar-xvf msmtp-1.8.1.tar
Cd msmtp-1.8.1
Yum-y install gnutls gnutls-devel gnutls-utils openssl openssl-devel libidn libidn-devel
If there is no yum instll, then the quarterly report may be wrong as follows:
Msmtp: support for TLS is not compiled in
. / configure-prefix=/usr/local/msmtp-sysconfdir=/usr/local/msmtp/etc-with-ssl=openssl & & sudo make & & sudo make install
Create or edit the msmtp configuration file in the user's home directory. I use the VI editor to achieve this goal
Vi / etc/msmtprc
Account gmail
Tls on
Auth on
Host smtp.gmail.com
Port 587
User user1@gmail.com
From user1@gmail.com
Password *
Or
Account qqmail
Tls on
Auth on
Tls_starttls off
Tls_trust_file / etc/ssl/certs/ca-bundle.crt
Host smtp.qq.com
Port 465
User 59090939@qq.com
From 59090939@qq.com
Password ttvingav
Because the file contains sensitive data such as passwords, you should assign security permissions
Chmod 600 / etc/msmtprc
Test sending email, if nothing happens, it should be able to send email normally.
Echo "hello" | msmtp-a qqmail-C / usr/local/msmtp/etc/msmtprc 59090939@qq.com
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.