I wonder if the problem is that you’re sending that message using whatever the person filling the form in entered as their email address, as the ‘from’ address. This may be a security problem, in that I’d expect a hosting company to check that you’re sending emails from an address that you’re paying them to host, and not spamming and so on.
Try changing it so that the $from value is another of your own (or the site owners own) email addresses, and include the form-fillers email address in the body of the message.
I tried that and it didn’t work unfortunately. The form does check if it’s a proper email address before allowing the user to submit it though so it should (in theory at least) always be a proper email address
might be a properly formatted email but not necessarily an email address that exists.
If you run <?php phpinfo(); ?> you should be able to get some more info about what is being run on the server. You can possibly amend the .ini contents on the page you are trying to build to send the email.
It might be a bit annoying as you’d have to check regularly but if you really can’t email out just submit the form to a database and have an admin log in area to pick up the ‘email’.
mail() isn’t particularly suited to getting info about email sending (mail() hands over the email to your sendmail executable and that’s it). therefore you should use one of the existing email libraries (e.g. SwiftMailer, PHPMailer) that can easily send email via SMTP.
PHP has an email filter that does a better job at that.
What I was getting at is that the mail server might need the from-address to be one that it is configured to send emails from, not just that it’s a properly-formatted email address. If it allows your form to use any old email address as the from-address, that would mean you could also use it to send emails purporting to be from anyone.
But if you’ve changed it to use your address as the from-address for sending the mail and it didn’t help, it must be something else.
i think the only problem is with double quotes.
header(“Location: mailto:email@address.com?Subject=New message from website&body=$body”);
should be,
header(“Location: mailto:email@address.com?Subject=New message from website&body=”.$body.“”);