I have a website where there is a contact form.
The email sent by this form (Gmail), I use a specific only for the site (form @ .....), however, when sending to the client, set the parameter From
as the (contact @ ....), which is from Gmail as well (I set up the form's email account so he could sign up as the contact).
When sending this email, I send a second email to the contact itself, however the latter, in turn, I'm trying to define as the client's email, but Gmail itself does not allow the e- mail sent is signed by a different email. Is there any alternative to this?
- Email and password were hidden
Code:
$nomeCliente = $_POST['nome'];
$emailCliente = $_POST['email'];
$emailEmpresa = "[email protected]";
$assuntoE1 = '=?UTF-8?B?'.base64_encode("Mil Blocos - Formulário do Website").'?=';
$assuntoE2 = '=?UTF-8?B?'.base64_encode($_POST['assunto']).'?=';
$mensagem = $_POST['mensagem'];
$mail = new PHPMailer();
$mail->isSMTP();
$mail->CharSet = 'UTF-8';
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'minhasenha';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->setFrom($emailCliente, $nomeCliente);
$mail->addAddress($emailEmpresa);
$mail->Subject = $assuntoE2;
$mensagem = 'E-mail do cliente: <br />' . $emailCliente . '<br /><br />' . 'Mensagem: <br />' . $mensagem;
$mail->MsgHTML($mensagem);
$mail->send();