0
I am unable to send email through my Vultr cloud account. I have an unblocked account to send emails but nothing happens when I send them. I have installed sendmail and when I send an email by ssh or php it "sends" without errors.
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if(!empty($_POST['contactname']) && !empty($_POST['contactemail']) && !empty($_POST['contactmessage'])) {
$to = '[email protected]'; // Your e-mail address here.
$body = "\nName: {$_POST['contactname']}\nEmail: {$_POST['contactemail']}\n\n\n{$_POST['contactmessage']}\n\n";
mail($to, "Mensagem via Website", $body, "From: {$_POST['contactemail']}"); // E-Mail subject here.
}
}
?>
The function
mail
does not useexceptions
. Check that it is not in the spam box and check if theheader
that is correct.– Valdeir Psr
In this case it seems to me that because the email server does not have much less authentication settings to be an email server. You should have an email server with reverse configured and authentication, after which I recommend using the Phpmailer project to send your emails.
– Felipe Gabriel