I am building a website for a school project(freshman) and wish to add a simple feedback form to it, which send emails to my personal gmail account. I don't really get an error but it doesn't send anything. The website uses Laravel but the feedback form I'm building is in simple php (it's mandatory for me to use some plain php). I have disabled that security setting in my google email, so that's not the issue. I already have a working Forgot Password function built with laravel which can send mails, but I don't know why this mail() function in plain php is not working.
Operating system is Ubuntu
Code:
<?php
if ( isset( $_GET['submit2'] ) ){
$to = "redacted@gmail.com";
$subject = "Feedback for the Website!";
$body = "A user has entered feedback on the site!\n";
$body .= "Their feedback is:\n\n";
$body .= $feedback ?? '';
print "Thanks for your feedback!";
mail($to, $subject, $body);
}
else {
?>
<form action="feedback" method="GET">
<h2>1Please Send us your Feedback</h2>
<textarea cols=35 rows=15 name="feedback">
</textarea>
<br>
<input type="submit" name="submit2" value="Submit">
</form>
<?php
php.ini
[mail function]
; For Win32 only.
; http://php.net/smtp
XAMPP
SMTP=smtp.gmail.com
; http://php.net/smtp-port
smtp_port=587
; For Win32 only.
; http://php.net/sendmail-from
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
http://php.net/sendmail-path
;sendmail_path=/opt/lampp/lib/php/Mail/sendmail.php
sendmail_from=redacted@gmail.com
auth_username=redacted@gmail.com
auth_password=redactedPassword