I am trying to send email from php to a gmail account. I have the following settings on my laptop:
- Windows 8
- Internet connection
- XAMPP 1.7.4, PHP Version 5.3.5,
I have the following php.ini settings
[mail function]; For Win32 only .; http://php.net/smtp SMTP = smtp.gmail.com; http://php.net/smtp-port
smtp_port =: 465
; For Win32 only .; http://php.net/sendmail-from ; sendmail_from = postmaster @ local
; Unix only. You can also specify arguments (default: "sendmail -t -i") .; http://php.net/sendmail-path ; sendmail_path = "\" C: \ xampp \ sendmail \ sendmail.exe \ "-t"
Below is the php code:
<?php
$to = 'goodmandiamont@gmail.com';
$subject = 'hi';
$msg = 'Test';
$headers = 'From: postmaster@localhost' ."\r\n" .
'Reply-To: shawn.danisa@gmail.com' . "\r\n" .
'X-Mailer: PHP /' . phpversion();
mail($to, $subject,$msg,$headers);
?>
I get the following error:
Warning: mail () [function.mail]: SMTP server response: 530 5.7.0 First you need to run the STARTTLS command.
I also made sure that the IMAP option is enabled in gmail settings. I also checked to see if I find the following lines in the php.ini file the following lines:
ini_set ("SMTP", "SSL: //smtp.gmail.com");
ini_set ("smtp_port", "465");
But no luck, I just can’t find them. Help, I'm new to php.