SMTP -> ERROR: Failed to connect to server: An attempt was made to access a socket in a way forbidden by its access permissions. (10013) The following From address failed: info@gmail.com : Called Mail() without being connected.
$mail = new PHPMailer(); $mail->IsSMTP(); $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = "tls"; $mail->Host = "smtp.gmail.com"; $mail->Port = 587; $mail->Username = "name@gmail.com"; $mail->Password = "password"; $mail->From = "info@gmail.com"; $mail->FromName = "name.com"; $mail->Subject = "Register"; $mail->MsgHTML($userMsg); $mail->AddAddress("useremail", "username"); $mail->send(); $mail->ClearAllRecipients();
Asked
Active
Viewed 763 times
0

Termininja
- 6,620
- 12
- 48
- 49

vivek
- 41
- 1
- 7
-
Possible duplicate of [An attempt was made to access a socket in a way forbidden by its access permissions](http://stackoverflow.com/questions/15619921/an-attempt-was-made-to-access-a-socket-in-a-way-forbidden-by-its-access-permissi) – aynber May 03 '16 at 14:25
-
is this an server issue not any problem in code right mine too is windows server – vivek May 03 '16 at 14:30
-
Try using port `465` instead. – mferly May 03 '16 at 14:31
-
not working with port 465 – vivek May 03 '16 at 14:42
-
1here is a solution for you. [http://stackoverflow.com/questions/16048347/send-email-using-gmail-smtp-server-through-php-mailer](http://stackoverflow.com/questions/16048347/send-email-using-gmail-smtp-server-through-php-mailer) – Mukesh Ram May 03 '16 at 14:51
-
Here is a [bunch](http://stackoverflow.com/search?q=[php]+%22email%22+%22error%22) of questions that might help you. Please utilize the advanced search feature before posting a question here.. – sjsam May 05 '16 at 17:30
-
Thats a server code is right. server is not allowing to send emails. – vivek May 10 '16 at 06:13