I am trying to send emails using the php mail(); function. I have installed msmtp to allow me to use a gmail account. However whenever I try to send test email using msmtp then a destination email, the system freezed and I cannot write more commands.

This is the contents of ~/.msmtprc:

account gmail tls on tls_starttls on tls_certcheck off auth on logfile ~/.msmtp.log host smtp.gmail.com port 587 user ****@gmail.com from ****@gmail.com password ********** account default : gmail 

Also when it does sometimes work, I get an error which says bad credentials even though the details are correct, access for less secure apps is on and there is no 2-step verification.

6

1 Answer

If allowing less secure app doesn't work, you should consider 2FA.

Here is my working configuration:

account default host smtp.gmail.com port 587 from "" tls on tls_starttls on tls_trust_file /etc/ssl/certs/ca-certificates.crt auth on user "yourusername" password "yourapppassword" logfile ~/.msmtp.log 
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy