ubuntu配置邮件服务

Centos下直接在/etc/mail.rc下配置就可以发送文件了

set from=abc@163.com smtp=smtp.163.com smtp-auth-user=abc@163.com smtp-auth-password=passwd  smtp-auth=login

 

ubuntu下可以安装ssmtp来实现邮件的发送

首先安装ssmtp

aptitude install ssmtp mailutils


然后再/etc/ssmtp目录下配置

ssmtp.conf的配置文件

# Config file for sSMTP sendmail

#

# The person who gets all mail for userids < 1000

# Make this empty to disable rewriting.

root=自己邮箱地址

# The place where the mail goes. The actual machine name is required no

# MX records are consulted. Commonly mailhosts are named mail.domain.com

mailhub=邮箱smtp服务器地址

# Where will the mail seem to come from?

#rewriteDomain=

# The full hostname

hostname=主机名

# Are users allowed to set their own From: address?

# YES - Allow the user to specify their own From: address

# NO - Use the system generated From: address

FromLineOverride=YES

AuthUser=邮箱地址

AuthPass=邮箱密码

 

Revaliases文件的配置

# sSMTP aliases

#

# Format:   local_account:outgoing_address:mailhub

#

# Example: root:your_login@your.domain:mailhub.your.domain[:port]

# where [:port] is an optional port number that defaults to 25.

root:自己的邮箱:邮箱smtp服务器地址:端口  (如果这里写root,那么只有root用户有权限使用,其他用户使用会报错cannot send message: Process exited with a non-zero status  )

#如自己的邮箱是腾讯的企业邮箱:

#root:自己邮箱:imap.exmail.qq.com:465    

 

配置完成后之后用 mail abc@163.com  发送邮件了


在这里我遇到过一个问题,mail时报错 cannot send message: Process exited with a non-zero status

检查之后发现是我把邮箱密码写错了,修改之后不再报错

如果报这个错有以下可能

1.配置文件写的不正确

2.安装了sendmail之类的邮件服务没有关闭,会导致冲突

3.没有使用root权限来运行mail

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值