Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Class 'PHPMailer' not found in /home2/turmaquevedo/public_html/enviar.php on line 15

New Here ,
Jun 30, 2019 Jun 30, 2019

Hy guys!

My name is Jomar and i'm from Rio de Janeiro Brazil. I'm beginner and I have a problem with PHPMailer to send a FORM:

I'd like to know what is wrong with de scripts below. Sorry for my English. Thanks all folks !

#Exemplo de envio de e-mail SMTP PHPMailer - www.secnet.com.br

//require_once ('vendor/autoload.php');

require_once ('vendor/phpmailer/phpmailer/src/PHPMailer.php');

require_once ('vendor/phpmailer/phpmailer/src/SMTP.php');

require_once ('vendor/phpmailer/phpmailer/src/Exception.php');   

use PHPMailer; (line 15 with error!)

use Exception;

error_reporting(E_ALL);

ini_set('display_errors', 'On');

# Inclui o arquivo class.phpmailer.php localizado na pasta phpmailer

$mail = new PHPMailer.php(true);

$mail->Subject = "Contato"; # Assunto da mensagem

# Inicia a classe PHPMailer

try {

# Define os dados do servidor e tipo de conexão

$mail->SMTPDebug = 2;

$mail->isSMTP(); // Define que a mensagem será SMTP

$mail->Host = 'host48.hoteldaweb.com.br'; # Endereço do servidor SMTP

//$mail->SMTPAutoTLS = false; // Utiliza TLS Automaticamente se disponível

$mail->SMTPAuth = true; # Usar autenticação SMTP - Sim

$mail->Username = 'jomar@turmaquevedo.org'; # Usuário de e-mail

$mail->Password = '********'; // # Senha do usuário de e-mail

$mail->SMTPSecure ='tls';

$mail->Port = 465; // Porta TCP para a conexão

# Define o remetente (você)

$mail->From ='jomar@turmaquevedo.org'; # Seu e-mail

$mail->FromName ='Jomar Rocha'; // Seu nome

# Define os destinatário(s)

$mail->AddAddress('jomar_rocha@outlook.com'); # Os campos podem ser substituidos por variáveis

#$mail->AddAddress('webmaster@nomedoseudominio.com'); # Caso queira receber uma copia

#$mail->AddCC('ciclano@site.net', 'Ciclano'); # Copia

#$mail->AddBCC('fulano@dominio.com.br', 'Fulano da Silva'); # Cópia Oculta

# Define os dados técnicos da Mensagem

$mail->IsHTML(true); # Define que o e-mail será enviado como HTML

$mail->CharSet = 'iso-8859-1'; # Charset da mensagem (opcional)

$nome= $_POST["nome"];

$email= $_POST["e-mail"];

$Telefone= $_POST ["telefone"];

$mensagem = $_POST["mensagem"];

$conteudo = "Nome: " . $nome . "\nE-mail: " . $email .  "\nTelefone: " . $Telefone . "\nMensagem: " . $mensagem;

$mail ->$conteudo;

# Define a mensagem (Texto e Assunto)

$mail->Body = "Este é o corpo da mensagem de teste,";

$mail->AltBody = "Este é o corpo da mensagem de teste, somente Texto! \r\n :)";

# Define os anexos (opcional)

#$mail->AddAttachment("c:/temp/documento.pdf", "documento.pdf"); # Insere um anexo

# Envia o e-mail

$enviado = $mail->Send();

} catch (Exception $e){

# Limpa os destinatários e os anexos

$mail->ClearAllRecipients();

$mail->ClearAttachments();

# Exibe uma mensagem de resultado (opcional)

if ($enviado) {

echo "E-mail enviado com sucesso!";

    header('Location: agradecimento.html');

} else {

echo "Não foi possível enviar o e-mail.";

echo "<b>Informações do erro:</b> " . $mail->ErrorInfo;

}

}

?>

TOPICS
Server side applications
404
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2019 Jun 30, 2019
LATEST

IANA has reassigned a new service to port 465, and it should no longer be used for SMTP communications. This could be the cause of the malfunction.

However, there are some servers that still use port 465. Get in touch with your host to get the correct port number.

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines