Hello,
I have a Processwire site that was made some years ago, and I got a complaint that the emails originating from it, ended up in Gmail's spam folder. I updated Processwire to 2.8, and changed the PHP mail() function I used before, to the newer $mail helper. In the beginning I used a Gmail email for the recipient, but later changed to an info@site.com type, thinking that this could be the problem. Still, the emails are marked as spam.
I used the following code (simplified):
$name = $input->post['name'];
$emailFrom = $input->post['email'];
$message = $input->post['message'];
$form = array(
'name' => $sanitizer->text($name),
'email' => $sanitizer->email($emailFrom),
'message' => $sanitizer->textarea($message),
);
$message = "Name: $form[name]\n" .
"Email: $form[email]\n" .
"Message: $form[message]";
$email = $mail->new();
$email->subject("Subject")
->to($pages->get('/settings/')->main_email)
->from($form['email'])
->body($message);
$email->send();
Should I use email header parameters? I can't find what to do in the docs.
Thanks