A
A
Alexander2018-12-25 16:10:15
PHP
Alexander, 2018-12-25 16:10:15

Why is mailer.php not working?

When submitting the form, it gives only " not working ", i.e. alternative text. Why doesn't it work? One-day mail so I won’t even change the login password for your convenience

<div id="modal-bloger" class="modal-bloger  ">
            <form action="mailer/smart.php" method="POST" class="modal-form">
              <p class="fieldset">
                <label class="bloger-email" for="label-email"></label>
                <input type="email" class="modal-bloger-email " name="bloger_email" placeholder="* Ваш e-mail" required>
              </p>

              <p class="fieldset">
                <label class="bloger-email" for="label-channel"></label>
                <input type="text" class="modal-bloger-channel " name="bloger_channel" placeholder="* Ваш канал" required>
              </p>
    
              <p class="fieldset">
                  <label class="bloger-theme" for="label-theme"></label>
                  <input type="text" class="modal-bloger-theme " name="bloger_theme" placeholder="Тематика канала">
              </p>
    
              <p class="fieldset">
                <input class="full-width" type="submit" value="Отправить заявку">
              </p>
            </form>
          </div> <!-- modal bloger -->

$blogerEmail = $_POST['bloger_email'];
$blogerChannel = $_POST['bloger_channel'];
$blogerTheme = $_POST['bloger_theme'];

require_once('phpmailer/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->CharSet = 'utf-8';

//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp.mail.ru';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = '[email protected]';                 // Наш логин
$mail->Password = 'QWEasd123';                           // Наш пароль от ящика
$mail->SMTPSecure = 'ssl';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 465;                                    // TCP port to connect to
 
$mail->setFrom('[email protected]', 'Random Guy');   // От кого письмо 
$mail->addAddress('[email protected]');     // Add a recipient
//$mail->addAddress('[email protected]');               // Name is optional
//$mail->addReplyTo('[email protected]', 'Information');
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'Блогер оставил заявку';
$mail->Body    = '
  Блогер оставил заявку <br> 
  Почта: ' . $blogerEmail . ' <br>
  Канал: ' . $blogerChannel . ' <br>
  Тематика: ' . $blogerTheme . '';
$mail->AltBody = 'Это альтернативный текст';

if(!$mail->send()) {
  echo "not working.";
} else {
  header('location: ../thankyou.html');
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Syomov, 2018-12-25
@stupedALilBit

Have you finished registering your mailbox, or has it just been created?
After creating it, you must enter it at least once through the mail.ru interface. Until then, smtp will not work.
For many other mail services, by the way, everything is similar.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question