I am using php mailer to generate and send automatic e-mails when a form is submitted on my web site which is run on GoDaddy. Since GoDaddy has changed their e-mail platform from Workspace to Office365 last week, my website stopped sending automatic e-mails, because host was changed, and since new host (Office365) required new settings (like different port number and SMTPSecure info). So I made some changes on my php code as following:
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtp.office365.com';
$mail->Username = '[email protected]';
$mail->Password = 'password';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->From = ('[email protected]');
$mail->addAddress('[email protected]');
$mail->FromName = 'myname';
After changing host to office365, SMTPSecure info to ‘tls’ and Port number to 587, I started to get the following error:
SMTP ERROR: Failed to connect to server: An attempt was made to access
a socket in a way forbidden by its access permissions. (10013)
2022-10-08 08:35:07 SMTP connect() failed
I have tried following ports: 25, 80, 465 and 587.
I have tried following SMTPSecure types: ‘tls’, ‘ssl’, ‘StartTLS’. But none of them worked.
I have also enabled SMTP authentication as advised in other answers. And tried all the alternative code snippets given in other questions but none of them worked.
Also, I have tried accessing my e-mail account and send automatic e-mail from Powershell. And it worked, so I think there is no issue with the e-mail account that I am using. So I’m thinking issue might be GoDaddy specific.
I have checked almost all of the questions and answers on websites but none of them worked. So I desperately need help to resolve this issue and start using my websites back. Any answer will be appreciated.
Thanks in advance.