apt-get install postfix
service postfix start
apt-get install mailutils
Отправим тестовое письмо
echo «BODY» | mail -s «SUBJECT» мое_мыло@gmail.com
После этого можем отправить письмо посредствам PHP
Код:
<?php
$to = 'send_to@email.com';
$subject = "Thank you for contacting Real-Domain.com";
$message = "
<html>
<head>
</head>
<body>
Thanks, your message was sent and our team will be in touch shortly.
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=utf-8" . "\r\n";
$headers .= 'From: admin@mail.ru' . "\r\n";
// SEND MAIL
if(mail($to,$subject,$message,$headers)){
echo 'Hello, my friend!';
}
?>