I am using the following code to send email:
<?php
require 'libs/PHPMailerAutoload.php';
$mailer = new PHPMailer();
$mailer ->isSMTP();
$mailer ->isHTML(true);
$mailer->CharSet = "UTF-8";
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = "tls";
$mailer->Host = "smtp.live.com";
$mailer->Port = 587;
$mailer->Username = "[email protected]";
$mailer->Password = "*********";
$mailer->From = "[email protected]";
$mailer->FromName = "leonardo vialrinho";
$mailer->Subject = "TESTE DE EMAIL";
$mailer->Body = "body HTML";
$mailer->AltBody = "body texto";
$mailer->addAddress("[email protected]");
if($mailer -> send()) {
echo "Enviado";
} else {
echo "Erro: ".$mailer->ErrorInfo;
}
?>
So far no problem, but what would it be like in a contact form? Where the user will not enter the password of email
of it. And I also do not think it's legal or even to put the password of my email
in the code (in case it would send a confirmation of registration, etc.)