Using Form Email in Addadress

Asked

Viewed 35 times

0

I have a problem sending email with AddAdress in my file that is receiving the form data .

I’ve tried everything here but it doesn’t work ='(

Detailing the situation:

I receive the address to which I wish to send the email here:

$Email                      = $_POST["Email"];


// Funciona normal, até uso em outros pontos no código e a string está perfeita

$mail->AddAddress($Email);

// Aqui não pega, mas caso eu coloque a string funciona.

Test initialize a variable to test like this:

$teste = "[email protected]";
$mail->AddAddress($teste, $Nome);

Was normal.


Test take the variable value $Email but it also did not take, in these two ways:

$teste = "$Email";
$teste = $Email.

Anyway I don’t know what else to do, the code is right but the problem is that I can’t use the email placed on the form =/

1 answer

0

Bro I’m not ninja in PHP but maybe I’ll give you a light in mine this way,

$destinatario = (isset($_POST['destinatario'])) ? $_POST['destinatario']: '[email protected]';

// Endereço do e-mail do destinatário

$mail->addAddress($destinatario);

It sends normal to my email

Browser other questions tagged

You are not signed in. Login or sign up in order to post.