ubuntu sendmail

1. sendmail必须先要安装两个包

    (1)sudo apt-get install sendmail

    (2)sudo apt-get install sendmail-cf

  2. ubuntu下最常使用的是mail功能,需要安装mailutils

    sudo apt-get install mailutils

  3. 若需要使用带“附件”的功能,还需要安装sharutils

    sudo apt-get install sharutils

  4. 测试

    输入命令:ps aux | grep sendmail

默认情况下,sendmail只会为本机用户发送邮件,若要将它扩展到整个Internet,则要进行以下配置。

  打开sendmail的配置宏文件:/etc/mail/sendmail.mv

  若仅仅在普通用户(非root权限)打开,如果没有在开头加“sudo”,则没有办法对该配置进行修改,此时需要使用命令:

    sudo vi /etc/mail/sendmail.mv

  将Addr=127.0.0.1改为0.0.0.0,表明可以连接到任何服务器上

三. 测试发送邮件

  常用的发送邮件方式有以下几种:

    1.如何写一般的邮件: mail [email protected]  Cc 编辑抄送对象,Subject:邮件主题,输入回车,邮件正文后,按Ctrl-D结束

    2.快速发送方式: echo “邮件正文” | mail -s 邮件主题 [email protected]

    3.以文件内容作为邮件正文来发送: mail -s test [email protected] < test.txt

    4.发送带附件的邮件: uuencode 附件名称 附件显示名称 | mail -s 邮件主题 发送地址

https://www.cnblogs.com/jiqianqian/p/7920603.html

猜你喜欢

转载自www.cnblogs.com/i-shu/p/11815784.html