Hello.

I create my website and want to send an order form to my e-mail. At the moment the site is on my local server. Who knows how to do this, tell me, please.

    1 answer 1

    Denver is a stub on the function mail. On hosting everything should work. Or rewrite the script under SMTP.

    Here is the simplest example with the mail function:

    <form method="post" action=""> Имя отправителя:<br /> <input type="text" name="user" size="50"><br /> E-mail отправителя:<br /> <input type="text" name="user_email" size="50"><br /> Тема сообщения:<br /> <input type="text" name="subject" size="50"> <br /> Текст сообщения:<br /> <textarea name="text" cols="80" rows="10" ></textarea><br /> <input type="submit" name="send_mail" value="Отправить"> </form> <?php if (isset($_POST['send_mail']) && isset($_POST['subject']) && isset($_POST['text']) && isset($_POST['user']) && isset($_POST['user_email'])) { /* получатели */ $to = "ВАШ E-MAIL"; /* тема/subject */ $subject = $_POST['subject']; $text = $_POST['text']; $user = $_POST['user']; $user_email = $_POST['user_email']; /* сообщение */ $message = ' <html> <head> <title>' . $subject . '</title> </head> <body>' . $text . ' </body> </html>'; /* Для отправки HTML-почты вы можете установить шапку Content-type. */ $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=Windows-1251\r\n"; /* дополнительные шапки */ $headers .= "From: " . $user . "<" . $user_email . ">\r\n"; if (mail($to, $subject, $message, $headers)) { echo "<b>Сообщение отправлено!</b>"; } else { echo "Ошибка отправки!"; } } else { echo "<font color=red><b>Не заполненны текстовые поля!!!</b></font>"; } ?> 
    • Thank you - Evkom