Hi, I'm trying to set up phpmailer for the first time. It has worked perfectly for me through the guides I've read, but I have not found a way to send mail without using SMTP.
I would like to know if there is a way to use it in this way, since I would like it when the emails arrive, where it says "FROM:" appears the email of the sender.
Here my code:
<?php
require("class.phpmailer.php");
require("PHPMailerAutoload.php");
$mail = new PHPMailer();
// VARIABLES
$name = $_POST["name"];
$email = $_POST["mail"];
$message = $_POST["message"];
$emailTo = "[email protected]";
$subject = $_POST["subject"];
//SMTP
//$mail->IsSMTP();
$mail->Host = "smtp.gmail.com";
$mail->Username = '[email protected]';
$mail->Password = 'xxxxxx*';
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Port = 465;
// ENCABEZADO
$mail->setFrom($email, $name);
$mail->addAddress($emailTo, $name);
$mail->Subject = $subject;
// MENSAJE
$mail->Body = $message;
// ENVIAR MENSAJE
if ($mail->send()) {
echo "<script type='text/javascript'>
alert('Enviado Correctamente');
</script>";
} else {
echo "<script type='text/javascript'>
alert('No enviado, intentar de nuevo');
</script>";
}
? >