问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/43815571/mailer-error-smtp-requires-user-credentials