D
D
DEnisLEB2018-06-23 20:34:27
PHPMailer
DEnisLEB, 2018-06-23 20:34:27

How to fix phpmailer error?

<?php
function Send_Mail($to,$subject,$body)
 {
require 'config/class.phpmailer.php';
 $from       = "[email protected]";
 $mail       = new PHPMailer();
 $mail->IsSMTP(true);            // используем протокол SMTP
 $mail->IsHTML(true);
 $mail->SMTPAuth   = true;                  // разрешить SMTP аутентификацию
 $mail->Host       = "tls://smtp.yourwebsite.com"; // SMTP хост
 $mail->Port       =  465;                    // устанавливаем SMTP порт
 $mail->Username   = "SMTP_Username";  //имя пользователя SMTP
 $mail->Password   = "SMTP_Password";  // SMTP пароль
 $mail->SetFrom($from, 'From Name');
 $mail->AddReplyTo($from,'From Name');
 $mail->Subject    = $subject;
 $mail->MsgHTML($body);
 $address = $to;
 $mail->AddAddress($address, $to);
 $mail->Send();
 }
 ?>

Fatal error: Cannot redeclare Send_Mail() (previously declared in D:\orion.com\pages\email\reg.php:2) in D:\orion.com\pages\email\reg.php on line 21

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Taratin, 2018-06-23
@Taraflex

Move to dependency management through composer rather than simple include/require

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question