Was coding PHP to send mail to a user on form submission:
This was the code:
The code ran without errors but no mail appeared.
I installed sendmail:
sudo apt-get install sendmail
and tried a mail:
echo "mail out" | sendmail -v mail@domain.com
Now the problem was that sendmail tried to send via localhost:
Connecting to [127.0.0.1] via relay...
So, over to the sendmail config: sudo vi /etc/mail/sendmail.mc
And added the row: define(`SMART_HOST',`esmtp:mail.domain.com')dnl
Restarted sendmail: sudo service restart sendmail
And BOOM! Mail recieved on form submission.
This was the code:
$to = "mail address";
$subject = "This is the subject";
$message = $_POST["arg1"] . $_POST['arg1'];
mail($to,$subject,$message, " -fmail@domain.com");
I installed sendmail:
sudo apt-get install sendmail
and tried a mail:
echo "mail out" | sendmail -v mail@domain.com
Now the problem was that sendmail tried to send via localhost:
Connecting to [127.0.0.1] via relay...
So, over to the sendmail config: sudo vi /etc/mail/sendmail.mc
And added the row: define(`SMART_HOST',`esmtp:mail.domain.com')dnl
Restarted sendmail: sudo service restart sendmail
And BOOM! Mail recieved on form submission.
Kommentarer
Skicka en kommentar