Answer the question
In order to leave comments, you need to log in
How to configure PHPMailer to send an email to an arbitrary address?
Good day to all. Ran into a little problem and got stuck. Please help with advice.
Given:
1. Text field with text
2. Field for entering e-mail
3. "Submit" button
The site visitor is asked to enter his e-mail address and click on the button. And then he will receive an email with the text from the text field.
If you manually specify mail addresses in the mail.php file, then everything is fine to come. But the letter does not come to the mail from the text field. Where to dig the problem?
Answer the question
In order to leave comments, you need to log in
$email = trim($_POST["email"]);
$mail = new PHPMailer();
// Параметры отправителя
$mail->setLanguage('ru', ($_SERVER["DOCUMENT_ROOT"] . '/include/phpmailer/language/'));
$mail->isSMTP();
$mail->Host = "mail.nic.ru";
$mail->SMTPAuth = true;
$mail->Username = "почта отправителя";
$mail->Password = "пароль от ящика";
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
$mail->CharSet = "utf-8";
$mail->setFrom("почта отправителя", "ТЕКСТ КОТОРЫЙ БУДЕТ В ЗАГОЛОВКЕ ПИСЬМА");
$mail->addAddress($email); // подставляем почту которую ввел пользователь
$mail->addBCC("сткрытая почта куда будет отправлена копия");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question