-1
Follow my php and html code
<?php
require("PHPMailer/PHPMailerAutoload.php");
if (isset($_POST['submit'])){
$enviaFormularioParaNome = 'Lucas';
$enviaFormularioParaEmail = '[email protected]';
$caixaPostalServidorNome = 'user';
$caixaPostalServidorEmail = '[email protected]';
$caixaPostalServidorSenha = 'senha';
$remetenteNome = $_POST['nome'];
$remetenteEmail = $_POST['email'];
$assunto = $_POST['tipoQuarto'];
$mensagem = $_POST['telefone'];
$entrada = $_POST['data1'];
$saida = $_POST['data2'];
$mensagemConcatenada = 'Solicitação de Reserva'.'<br/>';
$mensagemConcatenada .= '-------------------------------<br/><br/>';
$mensagemConcatenada .= 'Nome: '.$remetenteNome.'<br/>';
$mensagemConcatenada .= 'E-mail: '.$remetenteEmail.'<br/>';
$mensagemConcatenada .= 'Quarto: '.$assunto.'<br/>';
$mensagemConcatenada .= 'Entrada: '.$entrada.'<br/>';
$mensagemConcatenada .= 'Saída: '.$saida.'<br/>';
$mensagemConcatenada .= '<br/>';
$mensagemConcatenada .= 'Telefone: "'.$mensagem.'"<br/>';
require_once('PHPMailer/PHPMailerAutoload.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->Charset = 'utf8_decode()';
$mail->Host = 'smtp.'.substr(strstr($caixaPostalServidorEmail, '@'), 1);
$mail->Port = '587';
$mail->Username = $caixaPostalServidorEmail;
$mail->Password = $caixaPostalServidorSenha;
$mail->From = $caixaPostalServidorEmail;
$mail->FromName = utf8_decode($caixaPostalServidorNome);
$mail->IsHTML(true);
$mail->Subject = utf8_decode($assunto);
$mail->Body = utf8_decode($mensagemConcatenada);
$mail->AddAddress($enviaFormularioParaEmail,utf8_decode($enviaFormularioParaNome));
if(!$mail->Send()){
$mensagemRetorno = 'Erro ao enviar formulário: '. print($mail->ErrorInfo);
}else{
$mensagemRetorno = 'Formulário enviado com sucesso!';
}
}?>
<!DOCTYPE html>
<div class="col-lg-6 col-md-6 tm-contact-form-input col-lg-offset-3">
<div class="form-group">
<select name="tipoQuarto" id="finputtipo" class="form-control">
<option value="Quarto Individual">Quarto Individual</option>
<option value="Quarto Duplo">Quarto Duplo</option>
<option value="Quarto Triplo">Quarto Triplo</option>
<option value="Apartamento Individual">Apartamento Individual</option>
<option value="Apartamento Duplo">Apartamento Duplo</option>
<option value="Apartamento Triplo">Apartamento Triplo</option>
<option value="Apartamento individual com Ar">Apartamento individual com Ar</option>
<option value="Apartamento duplo com Ar">Apartamento duplo com Ar</option>
<option value="Apartamento de casal">Apartamento de casal</option>
<option value="Apartamento de casal com Ar">Apartamento de casal com Ar</option>
<option value="Apartamento de casal família com Ar">Apartamento de casal família com Ar</option>
</select>
</div>
<div class="form-group">
<input type="text" name="nome" id="nome" class="form-control" placeholder="Nome" />
</div>
<div class="form-group">
<input type="email" name="email" id="email" class="form-control" placeholder="Email" />
</div>
<div class="form-group">
<input type="text" name="fone" id="telefone" class="form-control" placeholder="Telefone" />
</div>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" name="data1" placeholder="Data de Entrada" />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
<div class="form-group">
<div class='input-group date' id='datetimepicker2'>
<input type='text' class="form-control" name="data2" placeholder="Data de Saída" />
<span class="input-group-addon">
<span class="fa fa-calendar"></span>
</span>
</div>
</div>
<div class="form-group">
<textarea id="obs" name="obs" class="form-control" rows="6" placeholder="Observação"></textarea>
</div>
<div class="form-group">
<button class="tm-submit-btn" type="submit" name="submit">Reservar</button>
</div>
</div>
</form>
</div>
</div>
</section>
You are requiring the file
PHPMailerAutoload.php
, but is making a mistake inPHPMailer-master/PHPMailerAutoload.php
? Strange.– Woss
is giving another error.. I edited
– user67645
Better define "new error". Does the first no longer occur? What has changed in your code?
– Woss
If you are in the same directory just Phpmailerautoload.php and not Phpmailer-master/Phpmailerautoload.php
– user60252
The first error no longer occurs because I changed the line
PHPMailer-master/PHPMailerAutoload.php
forPHPMailerAutoload.php
... but now you’ve made that last mistake.– user67645
phpmailer requires the classes class.phpmailer.php class.pop3.php class.smtp.php that should be in the same directory
– user60252
I put these three classes and put the require and this error appears:
Warning: require(class.phpmailer.php) [function.require]: failed to open stream: No such file or directory
– user67645
So edit your question and clarify your problem better. Put the structure of files and directories you are using, as well as the code.
– Woss
I created a folder called phpmailer and put the three files there
– user67645
your file you saved in the same folder phpmailer? or in a previous directory?
– user60252
in this case the four files must be in the phpmailer folder and in the send page.php must be require "phpmailer/Phpmailerautoload.php";
– user60252
What? It worked? Sleep coming this way
– user60252
so that two require in php? require("Phpmailer/Phpmailerautoload.php"); and require_once('Phpmailer/Phpmailerautoload.php');
– user60252
just one require
– user60252
gave certooooooooo... I took the require the most
– user67645
I’ll set off fires hahaha
– user60252