邮件错误:SMTP()需要用户凭据 [英] Mailer Error: SMTP() requires user credentials

查看:131
本文介绍了邮件错误:SMTP()需要用户凭据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个系统,当用户注册时,系统会通过激活链接向用户发送电子邮件.我正在使用SMTP connect()执行此过程.但是它会要求我向其发送电子邮件的用户凭据(带有密码),在生产级别上没有意义.在不知道用户凭据的情况下如何做到这一点?

I have a system where when the user registers, system will send an email to the user with activation link. I am doing this process using SMTP connect(). But it asks for user's credentials ( with password) to whom I want to send the email, which makes no sense in the production level. How can I do this without knowing the user credentials?

推荐答案

此问题已在这里进行了多次讨论-gmail不允许您从任意地址发送邮件,并且要求用户提供凭据以允许从其帐户发送邮件是只是疯子没有人应该永远这样做.不要从用户发送;从您自己的地址发送,并使用提交者的地址作为回复地址.这样,您只需要自己的凭据,就不会伪造发件人地址.

This has been covered many times on here - gmail doesn't allow you to send from arbitrary addresses, and asking for user's credentials to allow sending from their account is just bonkers; nobody should ever do that. Don't send from the user; send from your own address and use the submitter's address as a reply-to address. That way you only need your own credentials and will not be forging the from address.

这篇关于邮件错误:SMTP()需要用户凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆