Поправить скрипт отправки сообщений с сайта
после переноса с предыдущего сервера не работает скрипт на основе функции mail - обратный звонок, на хостинг функция включена 100%, проверено, сообщения отправляются на почту.
код самого скрипта:
<?php
$to = "емейлкудаслать";
##########################################
require 'PHPMailer/PHPMailerAutoload.php';
$_POST['email'] = !isset($_POST['email']) ? "емейлоткого" : $_POST['email'];
$mail = new PHPMailer;
$mail->isSendmail();
$mail->addAddress($to);
$mail->addReplyTo($_POST['email'], $_POST['name']);
$mail->setFrom($_POST['email'], $_POST['name']);
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);
$body = "";
$body .= "От: ".$_POST['name']."<br>";
$body .= "Телефон: ".$_POST['phone']."<br>";
if ($_POST['check'] != "callback") {
$body .= "Ссылка на конкурентов: <a href='".$_POST['link']."'>".$_POST['link']."</a><br>";
$body .= "Страница: <a href='".$_SERVER['HTTP_REFERER']."'>".$_SERVER['HTTP_REFERER']."</a>";
$mail->Subject = 'Клиент нашел дешевле #'.rand(10000,99999);
} else{
$mail->Subject = 'Заказ обратного звонка #'.rand(10000,99999);
}
$mail->Body = $body;
if(!$mail->send()) {
echo 'error';
} else {
echo 'good';
}
#print_r($mail);
?>
Основано на https://github.com/PHPMailer/PHPMailer/
-
436 49 6 2 Здравствуйте.
Сделаю все качественно и быстро. Большой опыт разработки сайтов.Обращайтесь!
-
10671 591 6 10 Готов взяться за работу, пишите, сделаю все качественно, опыт работы уже больше 8ми лет!
-
2652 161 0 Здравствуйте! Могу сделать прямо сейчас) Готов приступить сейчас
-
В логах есть ошибки? Может проблемы с подключением автолоадера phpmailer
-

Добрый день попробуйте так
<?php
$to = "емейлкудаслать";
##########################################
require 'PHPMailer/PHPMailerAutoload.php';
$_POST['email'] = !isset($_POST['email']) ? "емейлоткого" : $_POST['email'];
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'ваш_адрес@gmail.com';
$mail->Password = 'пароль';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->addAddress($to);
$mail->addReplyTo($_POST['email'], $_POST['name']);
$mail->setFrom($_POST['email'], $_POST['name']);
$mail->CharSet = 'UTF-8';
$mail->isHTML(true);
$body = "";
$body .= "От: ".$_POST['name']."<br>";
$body .= "Телефон: ".$_POST['phone']."<br>";
if ($_POST['check'] != "callback") {
$body .= "Ссылка на конкурентов: <a href='".$_POST['link']."'>".$_POST['link']."</a><br>";
$body .= "Страница: <a href='".$_SERVER['HTTP_REFERER']."'>".$_SERVER['HTTP_REFERER']."</a>";
$mail->Subject = 'Клиент нашел дешевле #'.rand(10000,99999);
} else{
$mail->Subject = 'Заказ обратного звонка #'.rand(10000,99999);
}
$mail->Body = $body;
if(!$mail->send()) {
echo 'error';
} else {
echo 'good';
}
#print_r($mail);
?>
-
Current freelance projects in the category PHP
Developer for CMS website project on Drupal 7 + PHP/MySQL.We are looking for a developer to assist with the setup of a CMS site on Drupal 7 + PHP/MySQL. Task:1. Create product cards for the entire range of products (currently, not all products on the site have product cards with descriptions and characteristics).2. Add correct… Content Management Systems, PHP ∙ 1 day 21 hours back ∙ 39 proposals |
Looking for a Bitrix24 specialist / CRM integrator to set up automation.Our company works with CRM Bitrix24. We need a specialist who can set up automatic addition of phone numbers to leads/orders in two formats. Automation must be correctly configured for two countries: the Republic of Moldova and Romania. Task: When creating a lead or order in… PHP, Web Programming ∙ 2 days 20 hours back ∙ 24 proposals |
Website optimizationOptimization of the website jdgreta.co.uk on Shopify. SEO audit attached to the project. Main tasks - - Fix all meta data - Complete the technical specifications for the programmer (since this project combines tasks for both the programmer and SEO, if you are not a company -… HTML & CSS, PHP ∙ 3 days 16 hours back ∙ 32 proposals |
Horoshop SpecialistNeed a specialist who can correctly set up the product Feed. Problem: Currently, over 13,000 products are being uploaded with the same type value (e.g., "everything for manicure and pedicure"). Because of this, it is impossible to segment products in Google Ads and set different… PHP, Website Maintenance ∙ 4 days 18 hours back ∙ 21 proposals |
Make sure that order emails from the store do not go to spam.Currently, there is a store on OpenCart, and order emails are landing in spam. We need to ensure they go to Inbox (ukr.net gmail) and check it. The hosting provider wrote: Poor email delivery may be related to a low sender reputation - IP or domain. In this case, we can advise… PHP, Web Programming ∙ 5 days 19 hours back ∙ 47 proposals |