Set up an SMTP server under Linux and send mail using the Mail command fine-Solution steps:
1.vi/etc/mail.rc
Append the following to the end:
set smtp=smtp.domain.com //Select the public mail domain name
set [email protected] //default Outgoing mail user
set smtp-auth-password=password //corresponds to the default user's password
set smtp-auth=login //Using login
By default
can also be written
Set [email protected] smtp=smtp.domain.com [email protected] Smtp-auth-password=password Smtp-auth=login
3. Save exit
4.mail-s "Custom message header Content" Recipient mailbox < Send content full path (belongs to file for mail sending)
or echo ' Custom file content ' | mail-s "Custom message header Content" Recipient mailbox (send content with Echo and | From the definition file)
Example Demo:
[[email protected] ~]# vi/etc/mail.rc (detailed steps for input)
[Email protected] ~]# tail-5/etc/mail.rc
Fwdretain subject date from to
# for Linux and BSD, this should is set.
Set Bsdcompat
Set from=chun_we***@163.com smtp=smtp.163.com smtp-auth-user=chun***u smtp-auth-password=chunw***985 smtp-auth= Login
[Email protected] ~]#
[Email protected] ~]# mail-s "Mail Test" chun*** @foxmail. com </etc/hosts
[[email protected] ~]# echo "hello,* Test auto Mail" |mail-s "test Write" 791***[email protected]
Mail receive map See attachment
Special Reminders :
Set Smtp-auth-password=password password some mail can be directly with the mailbox login password, some to reset the IMAP/SMTP, etc., different public mailboxes provided by the protocol or permissions are not the same, we recommend the use of @163.com
This article is from the "5chunwei" blog, be sure to keep this source http://5chunwei.blog.51cto.com/11136002/1758685
Set up the SMTP server under Linux and send the message with the Mail command fine solution