Configure mailx in Centos to send emails using external smtp

Source: Internet
Author: User

Configure mailx in Centos to send emails using external smtp
Configure mailx in Centos to use external smtp to send mail to install mailx

yum install mailx
Configure mailx

I recommend 163 mail, of course, QQ mail is also acceptable, PS: Remember to enter the mailbox to open SMTP

Vi/etc/mail. rc // if it does not exist, edit/etc/nail. rc.

Add the following code at the end of the file. Enter your own account and password for the corresponding account and password.

Set from = "xxx@163.com" set smtp = smtp.163.comset smtp-auth-user = xxxset smtp-auth-password = mailbox password set smtp-auth = login
Use mailx to send emails

The sender name cannot be added. The sender name has been configured in step 2.

If the mail content is stored in the mesg file, you can use the following two methods:

Mailx-s "sender name mail title" xxx@163.com <mesg
Cat mesg | mailx-s "sender name mail title" xxx@163.com

Multiple recipients are separated by commas:

Cat mesg | mailx-s "sender name mail title" xxx@163.com, xxx2@163.com, xxx3@163.com

You can also enter the mail content directly from the command line:

Mailx-s "sender name email title" xxx@163.com # press Ctrl + D after entering
echo  hello word | mailx -v -s " title" xxx3@163.com
Pitfall
  • Remember to enter the mailbox to open SMTP
  • After configuring the proxy, remember to check whether the proxy is enabled (for example, firewall VPN). The proxy may cause Telnet to fail over port 25.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.