sendmail: fatal: parameter inet_interfaces: no local interface found for ::1

使用gitlab测试邮件通知的时候报这个错

sendmail: fatal: parameter inet_interfaces: no local interface found for ::1

网上搜索要修改这个文件

vim /etc/postfix/main.cf

把下面两行

inet_interfaces = localhost

inet_protocols = all

改为

inet_interfaces = all

inet_protocols = all

再重启postfix

service postfix start

错误解决,记录一下

欢迎关注「不出户」公众号 

在公众号回复「python」,获取全套python学习资源。

在公众号回复「vue」,领取vue核心教程

在公众号回复「react」,领取react全套教程

在公众号回复「angular」,领取angular学习资源

在公众号回复「算法」,领取算法学习教程

在公众号回复「nodejs」,领取nodejs学习教程,更有更多精品资源敬请期待

欢迎关注不出户,让你足不出户爱好学习

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
这个错误通常是由于密码错误导致的。如果您使用的是Gmail,则需要在应用程序密码中生成一个应用程序密码,并使用该密码代替您的常规密码。如果您使用的是其他电子邮件提供程序,则需要确保您输入的密码是正确的,并且您的帐户已启用SMTP。以下是一些可能有用的步骤: 1. 确保您的密码是正确的,并且您的帐户已启用SMTP。 2. 如果您使用的是Gmail,请在Google帐户中生成一个应用程序密码,并使用该密码代替您的常规密码。 3. 确保您的代码中使用了正确的端口和主机名。 4. 确保您的代码中使用了正确的身份验证方法。 以下是一个使用Python发送电子邮件的示例代码,其中包括身份验证和错误处理: ```python import smtplib from email.mime.text import MIMEText from email.mime.multipart import MIMEMultipart from email.mime.base import MIMEBase from email import encoders # 设置发件人和收件人 sender_email = "your_email_address" receiver_email = "recipient_email_address" # 创建一个带有附件的电子邮件 message = MIMEMultipart() message["From"] = sender_email message["To"] = receiver_email message["Subject"] = "Test email with attachment" # 添加正文 body = "This is a test email with attachment." message.attach(MIMEText(body, "plain")) # 添加附件 filename = "example.txt" attachment = open(filename, "rb") part = MIMEBase("application", "octet-stream") part.set_payload((attachment).read()) encoders.encode_base64(part) part.add_header("Content-Disposition", "attachment; filename= " + filename) message.attach(part) # 连接到SMTP服务器并发送电子邮件 try: server = smtplib.SMTP("smtp.gmail.com", 587) server.starttls() server.login(sender_email, "your_app_password") text = message.as_string() server.sendmail(sender_email, receiver_email, text) print("Email sent successfully!") except Exception as e: print("Error sending email: ", str(e)) finally: server.quit() ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

木豪末

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值