Answer the question
In order to leave comments, you need to log in
Sending letters from the site from the Yandex service, via mail from a domain name, how to implement?
Hello.
I made mail through Yandex content, [email protected]
There is a site, the site has a regular form that I fill out and letters should go from it to the mail in the form and to the mail to the admin.
It didn’t even work out for me, I need to somehow add mail from the Yandex service and specify the port, password and login, etc.
How can this be done? (I would like not to use any phpmailer, etc.).
My file that processes and sends emails from the send.php form
<?php
$url = $_SERVER['HTTP_HOST'];
$data = $_POST;
$fio = $data['fio'];
$emai = $data['emai'];
$tel = $data['tel'];
$oblast = $data['oblast'];
$gor = $data['gor'];
$marka = $data['marka'];
$model = $data['model'];
$god = $data['god'];
$vin = $data['vin'];
$nomerkyz = $data['nomerkyz'];
$shassi = $data['shassi'];
$probegts = $data['probegts'];
$regznak = $data['regznak'];
$massa = $data['massa'];
$razmax = $data['razmax'];
$kattc = $data['kattc'];
$markashin = $data['markashin'];
$tiptop = $data['tiptop'];
$toptormz = $data['toptormz'];
$tipregdoky = $data['tipregdoky'];
$seria = $data['seria'];
$nomer = $data['nomer'];
$kogdavidan = $data['kogdavidan'];
$kemvidan = $data['kemvidan'];
$ispolz = $data['ispolz'];
$info = "<table style='font-size:13px; font-family: tahoma, sans-serif'>
<tr>
<td><strong>ФИО: </strong> </td>
</tr>
<tr>
<td>" . $fio . "</td>
</tr>
<tr>
<td><strong>Электронная почта: </strong> </td>
</tr>
<tr>
<td>" . $emai . "</td>
</tr>
<tr>
<td><strong>Номер телефона: </strong> </td>
</tr>
<tr>
<td>" . $tel . "</td>
</tr>
<tr>
<td><strong>Область проживания: </strong> </td>
</tr>
<tr>
<td>" . $oblast . "</td>
</tr>
<tr>
<td><strong>Город проживания: </strong> </td>
</tr>
<tr>
<td>" . $gor . "</td>
</tr>
</table>
<br/><br/>
<div style='font-size:14px; font-family: tahoma, sans-serif'><strong>Информация о транспортном средстве</strong></div><br/>
<table style='font-size:13px; font-family: tahoma, sans-serif'>
<tr>
<td><strong>Марка: </strong> </td>
</tr>
<tr>
<td>" . $marka . "</td>
</tr>
<tr>
<td><strong>Модель: </strong> </td>
</tr>
<tr>
<td>" . $model . "</td>
</tr>
<tr>
<td><strong>Год: </strong> </td>
</tr>
<tr>
<td>" . $god . "</td>
</tr>
<tr>
<td><strong>VIN: </strong> </td>
</tr>
<tr>
<td>" . $vin . "</td>
</tr>
<tr>
<td><strong>Номер кузова: </strong> </td>
</tr>
<tr>
<td>" . $nomerkyz . "</td>
</tr>
<tr>
<td><strong>Шасси (Рама) №: </strong> </td>
</tr>
<tr>
<td>" . $shassi . "</td>
</tr>
<tr>
<td><strong>Пробег ТС (км): </strong> </td>
</tr>
<tr>
<td>" . $probegts . "</td>
</tr>
<tr>
<td><strong>Гос. регистрационный знак: </strong> </td>
</tr>
<tr>
<td>" . $regznak . "</td>
</tr>
<tr>
<td><strong>Масса без нагрузки (кг): </strong> </td>
</tr>
<tr>
<td>" . $massa . "</td>
</tr>
<tr>
<td><strong>Разрешенная макс. масса (кг): </strong> </td>
</tr>
<tr>
<td>" . $razmax . "</td>
</tr>
<tr>
<td><strong>Категория ТС: </strong> </td>
</tr>
<tr>
<td>" . $kattc . "</td>
</tr>
<tr>
<td><strong>Марка шин: </strong> </td>
</tr>
<tr>
<td>" . $markashin . "</td>
</tr>
<tr>
<td><strong>Тип топлива: </strong> </td>
</tr>
<tr>
<td>" . $tiptop . "</td>
</tr>
<tr>
<td><strong>Тип тормозной системы: </strong> </td>
</tr>
<tr>
<td>" . $toptormz . "</td>
</tr>
<tr>
<td><strong>Тип рег. документа: </strong> </td>
</tr>
<tr>
<td>" . $tipregdoky . "</td>
</tr>
<tr>
<td><strong>Серия: </strong> </td>
</tr>
<tr>
<td>" . $seria . "</td>
</tr>
<tr>
<td><strong>Номер: </strong> </td>
</tr>
<tr>
<td>" . $nomer . "</td>
</tr>
<tr>
<td><strong>Когда выдан: </strong> </td>
</tr>
<tr>
<td>" . $kogdavidan . "</td>
</tr>
<tr>
<td><strong>Кем выдан: </strong> </td>
</tr>
<tr>
<td>" . $kemvidan . "</td>
</tr>
<tr>
<td><strong>Используется как такси/автобус? </strong> </td>
</tr>
<tr>
<td>" . $ispolz . "</td>
</tr>
</table>";
$message = "<div style='font-size:14px; font-family: tahoma, sans-serif'><strong>Заявка для получения Диагностической карты.</strong></div><br />";
$message .= $info;
$subject = "Заявка для получения Диагностической карты";
$headers .= "From: [email protected]сайт.ru\r\n". "Content-type: text/html; charset=utf-8 \r\n";
$emails = array("[email protected]сайт.ru");
if (is_array($emails))
{
foreach ($emails as $email)
{
if (!empty($email))
{
$email = trim($email);
mail($email, $subject, $message, $headers);
//отправка на емаил с формы
mail($data['emai'], $subject, $message, $headers);
}
}
}
header('Location: /done/');
?>
return array(
/**
* SwiftMailer driver, used with the email module.
*
* Valid drivers are: native, sendmail, smtp
*/
'driver' => 'smtp',
/**
* To use secure connections with SMTP, set "port" to 465 instead of 25.
* To enable TLS, set "encryption" to "tls".
*
* Note for SMTP, 'auth' key no longer exists as it did in 2.3.x helper
* Simply specifying a username and password is enough for all normal auth methods
* as they are autodeteccted in Swiftmailer 4
*
* PopB4Smtp is not supported in this module as I had no way to test it but
* SwiftMailer 4 does have a PopBeforeSMTP plugin so it shouldn't be hard to implement
*
* Encryption can be one of 'ssl' or 'tls' (both require non-default PHP extensions
*
* Driver options:
*
* @param null native: no options
* @param string sendmail: executable path, with -bs or equivalent attached
* @param array smtp: hostname, (username), (password), (port), (encryption)
*/
// 'options' => NULL
'options' => array(
'hostname' => 'smtp.yandex.ru',
'username' => '[email protected]сайт.ru',
'password' => 'pass',
'port' => '465',
'encryption' => 'ssl',
),
);
Answer the question
In order to leave comments, you need to log in
the mail function cannot use SMTP.
you will have to master phpmailer / analogues.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question