I'm not able to send an email form to my Hotmail email. Here are the codes below:
Form with the data that will be sent.
<form id="form-contato" method="post" action="email.php">
<div>
<div class="row">
<div class="6u 12u(mobile)">
<input type="text" name="name" id="nome" placeholder="Nome" />
</div>
<div class="6u 12u(mobile)">
<input type="text" name="email" id="email" placeholder="Email" />
</div>
</div>
<div class="row">
<div class="12u">
<input type="text" name="subject" id="assunto" placeholder="Assunto" />
</div>
</div>
<div class="row">
<div class="12u">
<textarea name="message" id="mensagem" placeholder="Mensagem"></textarea>
</div>
</div>
<div class="row 200%">
<div class="12u">
<ul class="actions">
<li><input type="submit" value="Enviar mensagem"/></li>
<li><input type="reset" value="Limpar campos" class="alt" /></li>
</ul>
</div>
</div>
</div>
</form>
Email.php class to capture form data and send email:
<?php
require_once 'PHPMailer/PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->SMTPDebug=1;
$mail->isSMTP();
$mail->CharSet = "utf8";
$mail->Host = 'smtp.live.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'minhasenha';
$mail->SMTPSecure = 'tls';
$mail->Port = 465;
$mail->FromName = "De";
$mail->isHTML(true);
$mail->addAddress($_POST['email'],$_POST['nome']);
$mail->Subject = $_POST['assunto'];
$mail->Body =$_POST['mensagem'];
if(!$mail->Send()){
echo 'Erro ao enviar e-mail: '.$mail->ErrorInfo;
}else{
echo 'E-mail enviado';
}
Error returned: