公司10.04tls,默认sendmail指向exim4,其实我也不知是啥,网上查了查,可以配合nagios3做发送邮件使用。
家里11.10,apt-get安装exim4,途中出现什么不能立即配置,解决办法是把和exim4有冲突的东西全部卸载,貌似我最后卸载了一个叫ssmtp的东西就好了
------简单的分割线------
家里的配置方法
由于家里没有邮件服务器,利用gmail的smtp做邮件服务器发送邮件
sudo dpkg-reconfigure exim4-config
邮件系统常见类型:用 smarthost 发信;无本地信件
邮件系统名称:tbq(我的机器名默认的)
要监听入站 SMTP 连接的 IP 地址:127.0.0.1(只监听本机的)
其它可接收邮件的目的地址:
本地用户的可见域名:tbq(我的机器名默认的)
寄信使用的 smarthost 的 IP 地址或主机名:smtp.gmail.com
保持最小 DNS 查询量吗 (按需拔号,Dial-on-Demand)?否
将设置文件分拆成小文件吗?否
将会自动重启服务,生成一个配置文件
/etc/exim4/update-exim4.conf.conf
- tbq@tbq:~$ sudo cat /etc/exim4/update-exim4.conf.conf
- # /etc/exim4/update-exim4.conf.conf
- #
- # Edit this file and /etc/mailname by hand and execute update-exim4.conf
- # yourself or use 'dpkg-reconfigure exim4-config'
- #
- # Please note that this is _not_ a dpkg-conffile and that automatic changes
- # to this file might happen. The code handling this will honor your local
- # changes, so this is usually fine, but will break local schemes that mess
- # around with multiple versions of the file.
- #
- # update-exim4.conf uses this file to determine variable values to generate
- # exim configuration macros for the configuration file.
- #
- # Most settings found in here do have corresponding questions in the
- # Debconf configuration, but not all of them.
- #
- # This is a Debian specific file
- dc_eximconfig_configtype='satellite'
- dc_other_hostnames=''
- dc_local_interfaces='127.0.0.1'
- dc_readhost='tbq'
- dc_relay_domains=''
- dc_minimaldns='false'
- dc_relay_nets=''
- dc_smarthost='smtp.gmail.com'
- CFILEMODE='644'
- dc_use_split_config='false'
- dc_hide_mailname='true'
- dc_mailname_in_oh='true'
- dc_localdelivery='mail_spool'
还有一个文件需要配置,smtp的用户名密码文件
/etc/exim4/passwd.client
- # password file used when the local exim is authenticating to a remote
- # host as a client.
- #
- # see exim4_passwd_client(5) for more documentation
- #
- # Example:
- ### target.mail.server.example:login:password
- gmail-smtp-msa.l.google.com:user@gmail.com:password
上面红色字体部分是ping smtp.gmail.com得到的地址,如果直接写smtp.gmail.com我这边不好用不知为啥
网上资料说还需要改一个文件/etc/email-addresses
但是我测试/etc/email-addresses文件内容是否修改好像没啥关系,因为我只向外发邮件
测试发邮件
echo "text" | mail -s "title" xxxxxxx@qq.com
qq邮箱成功收到邮件
阅读(4880) | 评论(1) | 转发(0) |