Hi,
Many of you have problems sending emails with gmail.
First, try it out on your production environment. On Windows with the Scriptcase environment, I have not yet managed to get it working, this is my error :
Fatal error: Uncaught Swift_TransportException: Connection could not be established with host smtp.gmail.com [ #0]
This is my code :
// Email parameters
$mail_smtp_server = 'smtp.gmail.com'; // SMTP server name or IP address
$mail_smtp_user = 'BLABLA@gmail.com'; // SMTP user name
$mail_smtp_pass = 'PASSWORD'; // SMTP password
$mail_from = 'BLABLA2@gmail.com'; // From email
$mail_to = 'BLABLA3@gmail.com'; // To email
$mail_subject = 'Test message'; // Message subject
$mail_message = 'This is a test message.'; // Message body
$mail_format = 'T'; // Message format: (T)ext or (H)tml
$mail_copies = ''; // List of the emails that will recieve the message
$mail_tp_copies = ''; // Type copies: BCC (Hiden copies) or CCC (Regular copies)
$mail_port = '465'; // Server port
$mail_tp_connection = 'S'; // Connection security (S) or (N)
// Send email";
sc_mail_send($mail_smtp_server,
$mail_smtp_user,
$mail_smtp_pass,
$mail_from,
$mail_to,
$mail_subject,
$mail_message,
$mail_format,
$mail_copies,
$mail_tp_copies,
$mail_port,
$mail_tp_connection);
In my production serveur in /var/log/apache/error.log i can see :
PHP Fatal error: Uncaught Swift_TransportException: Expected response code 250 but got code “535”, with message "535-5.7.8 Username and Password not accepted. Learn more at\r\n535 5.7.8 https://support.google.com/mail/?p=BadCredentials
Solution : Click here https://myaccount.google.com/lesssecureapps?pli=1 and enable Allow less secure apps: ON
So now in Windows in the development environment what should I do?
Thank