修改/etc/mail.rc文件,在最后一行加入以下内容

set from=fromUser@donai.com               #发送的邮件地址(发件人)
set smtp=smtp.domain.comset               #smtp服务器地址
set smtp-auth-user=username               #邮箱用户名
set smtp-auth-password=password           #邮箱密码
set smtp-auth=login                       #邮箱认证方式

举例

set from=zhangsan@163.com smtp=smtp.163.com
set smtp-auth-user=zhangsan smtp-auth-password=Passwd smtp-auth=login

发邮件邮件

mail -s "hosts" 628905@qq.com < /etc/hosts

# -s 指定邮件主题 hosts
# 收件人 628905@qq.com
# 邮件内容为/etc/hosts内的内容

 

相关文章:

  • 2021-06-26
  • 2021-09-01
  • 2022-12-23
  • 2021-09-21
  • 2021-06-17
  • 2021-05-22
猜你喜欢
  • 2021-08-05
  • 2021-10-09
  • 2022-12-23
  • 2021-09-22
  • 2021-10-14
  • 2021-08-10
相关资源
相似解决方案