Well folks, I'm building a website and I needed to get a domain to handle the contacts page, rather the emails.
The problem is this: I am using phpmailer and I want the user to be able to communicate with the "owner" of the website, ie, any email [email protected] would receive / manage all emails from users.
However using gmail SMTP (the only one I found "free") gives me a lot of errors that I think are permissions.
I have tried the "Postmarapp", but the problem is that they ask for domain of the website, something that I do not yet have, because, the same is still under construction.
So I wanted to know if it's possible to get that domain before it's done.
I also leave here the code (form HTML and php) that I have used. (P.S: gmail SMTP)
<form class="form-horizontal" role="form" method="post">
<div class="form-group">
<label for="inputname3" class="col-sm-2 control-label">Nome</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputname3" placeholder="Nome" name="sendName">
</div>
</div>
<div class="form-group">
<label for="inputEmail3" class="col-sm-2 control-label">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control" id="inputEmail3" placeholder="Email" name="sendEmail">
</div>
</div>
<div class="form-group">
<label for="inputPass3" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" class="form-control" id="inputPass3" placeholder="Password Email" name="sendPass">
</div>
</div>
<div class="form-group">
<label for="inputAssunto3" class="col-sm-2 control-label">Assunto</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="inputAssunto3" placeholder="Assunto" name="sendSubject">
</div>
</div>
<div class="form-group">
<label for="inputMessage3" class="col-sm-2 control-label">Mensagem</label>
<div class="col-sm-10">
<textarea placeholder="Escreva aqui a sua mensagem*" id="inputMessage3" name="sendMessage"></textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default" name="send">Enviar</button>
</div>
</div>
</form>
$name = $_POST['sendName'];
$email = $_POST['sendEmail'];
$subject = $_POST['sendSubject'];
$message = $_POST['sendMessage'];
$password = $_POST['sendPass'];
require_once('phpmailer/class.phpmailer.php');
require_once('phpmailer/PHPMailerAutoload.php');
require_once('phpmailer/class.smtp.php');
define('GUSER', $email);
define('GPWD', $password);
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
//$mail->Priority = 1; // Highest priority - Email priority (1 = High, 3 = Normal, 5 = low)
$mail->CharSet = 'UTF-8';
$mail->Host = 'smtp.gmail.com';'smtp.live.com';
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = GUSER;
$mail->Password = GPWD;
$mail->From = $email;
$mail->msgHTML($message);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->SetFrom($email,$name);
$mail->AddAddress("[email protected]","Joao");
$mail->AddReplyTo($email,$name);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message has been sent";
}