When trying on Windows, it is pretty simple. I have this code in the body of a PHP file:
$to = "[email protected]";
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: ' . $_POST['email'] . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$fullText = "Complaint from : " . $_POST['email'] . "\r\n" . "Name : " .
$_POST['fullName'] . "\r\n" . $_POST['mainText'] . "\r\n";
mail($to, $_POST['subject'], $fullText, $headers);
And I have this sendmail.ini
file:
[sendmail]
smtp_server=smtp.gmail.com
smtp_port=587
error_logfile=error.log
debug_logfile=debug.log
[email protected]
auth_password=XXXXXXXXXX
[email protected]
And basically, what I want to do is send an email from an account called [email protected]
to a different account called [email protected]
, where the first email has a password. On Windows, this works.
Now on Linux, there is no sendmail.ini
file that comes with LAMPP. I have been browsing all over everywhere for ways I can go around this, like this, but whatever I try, does not work. I even tried to use Postfix using steps from here, but it didn't work either.
I realise that these guides may just be wrong because of how old they are, but I cannot find any recent guides to how to do this. Can anyone tell me how this can be made possible on linux?