Hello guys, i’am trying to use mail from php but something is wrong, it works but then it is displayed
Application error
An error occurred in the website and your page could not be displayed. If you are the website owner, check your logs for details.
So i can’t redirect the page.
somethings about the code
– form
Nome
<div class="input-field">
<input name="email" type="email" class="validate">
<label for="email">Email</label>
</div>
<div class="input-field">
<textarea autocomplete="off" required id="descricao" name="descricao" class="materialize-textarea text-white"></textarea>
<label for="descricao">Descricão</label>
</div>
<div class="input-field">
<input class="btn carousel-background waves-effect waves-light" type="submit" value="Enviar">
</div>
</div>
</div>
</form>
–class method
public function send($tipo){
try{
mail(‘mensageirosdeemanuel.go@gmail.com’, $tipo ,$this->getDescricao());
header(“Location :”.BASE_URL.“Home”);
}catch(Exception $e){
throw $e;
}
}
– controller method
public function send(){
if(isset($_POST[‘descricao’]) && !empty(’$_descricao’)){
$mensagem = new Mensagem();
$mensagem->setEmail(addslashes((isset($_POST[‘email’])?$_POST[‘email’]:‘Sem email’)));
$mensagem->setNome(addslashes((isset($_POST[‘nome’])?$_POST[‘nome’]:‘Sem nome’)));
$mensagem->setDescricao(addslashes($_POST[‘descricao’])."\nNome: “. $mensagem->getNome().”\nEmail: ".$mensagem->getEmail());
$mensagem->send("Pedido de Oração");
header("Location :".BASE_URL."Home");
exit;
}
header("Location :".BASE_URL."Home");
}