The code is OK. Sometimes GMail considers your sending action as spam activity so it blocks SMTP. That's why I recommend you to check SMTP settings in Gmail.
Type: Posts; User: nickyc
The code is OK. Sometimes GMail considers your sending action as spam activity so it blocks SMTP. That's why I recommend you to check SMTP settings in Gmail.
Check GMail settings for SMTP, maybe it blocks SMTP again.