0
Hello, I have been trying to send an email through the PHP mail function, but nothing works, and after searching a little, I found a site that said it was necessary to have a fifth parameter, being the email that will receive the message, preceded by a -f
, and it doesn’t work that way, here’s what I’ve got so far:
$dest = "[email protected]";
$nome = $_POST['nome'];
$email = $_POST['email'];
$assunto = $_POST['assunto'];
$header = "MIME-Version: 1.1 \r\n";
$header .= "Content-type: text/plain; charset=iso-8859-1 \r\n";
$header .= "From: $email \r\n";
$header .= "Return-Path: $email \r\n";
$header .= "Reply-To: $dest \r\n";
$msg = $_POST['text'];
$mail = mail($dest, $assunto, $msg, $header, -f$dest);
And I have no idea what it might be, I’ve tried so much...
Use Phpmailer, you must inform the SMTP http://blog.thiagobelem.net/enviar-e-mails-pelo-php-usando-o-phpmailerconfiguration/
– Pedrox
First of all, you need to set up the file
php.ini
with the parameters of your smtp server– gmsantos
You need to provide more details of your environment, is windows? is an external host or localhost?
– rray
@rray I’m sending from a windows using shaman(localhost).
– Jorge Felix
How to send email from localhost using the PHP mail function?
– rray
Try to last the sendgrid "https://sendgrid.com/", probably this your code is from some random template, and usually these functions in email sending php never work.
– user33235