I solve the banal task - sending mail using php.
The form processing code is:
if((isset($_POST['username'])&& $_POST['username']!='')&& (isset($_POST['email'])&& $_POST['email']!='')) { //Проверка отправилось ли наше поля name и не пустые ли они $to = 'recepient@example.com'; //Почта получателя, через запятую можно указать сколько угодно адресов $subject = 'Заявка с сайта example.com'; $message = ' <html> <head> <title>'.$subject.'</title> </head> <body> <p>Имя заказчика: '.$_POST['username'].'</p> <p>Его телефон: '.$_POST['email'].'</p> <p>Обращение было сделано с сайта example.com</p> </body> </html>'; $headers = "Content-type: text/html; charset=utf-8; \r\n"; //Кодировка письма $headers.= "From: Birthday Reminder <birthday@example.com>\r\n"; $headers.= "Bcc: birthday-archive@example.com\r\n"; mail($to, $subject, $message, $headers); //Отправка письма с помощью функции mail print_r($_POST); print($headers); }
The POST output gives the following result:
Array ([email] => int@mail.ru [username] => Andrey25)
Content-type: text / html; charset = utf-8;
From: Birthday Reminder
Bcc: birthday-archive@example.com
As if everything is there except the mailbox itself, which I simply display on the screen. Explain to me, what is this for such "wonders" of technology here?