I have a client that I don’t host for, who is on a unix server that I know nothing about. I’m trying to set up an email script but it fails and I’m not sure why. I am not a PHP expert. Here’s the code I have:
<?php
$to = "[email protected]";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
if (mail($to, $subject, $body))
{
echo("
At what point is your script failing? Are you getting any error messages? Are you seeing any messages the script contains upon submitting the form? Post your form here, maybe there is something wrong with it.
MetaSkinny, This code doesnt needs a form as it isnt using any variable from the HTTP request.
David, let us know if you see any error. If it is only the email not being delivered, please open a ticket. This can happen if the destination is at providers like AOL,RR or Optimum Online, due to lack of rDNS.
It’s actually not on a jodo server. This particular client of mine does not host with me, but just asked for an email form on their site.
There are no error messages received. It simply says “Message delivery failed…” per the script if the mail is not sent. No other message than that, though.
Could it be something in their server configuration?
I took the liberty of assuming that you were trying to send email from a HTML form on a web page, even though your code had no HTTP request, as Tanmaya correctly pointed out.
Does your client want someone to fill out a form on their web site and have the information sent to them via email? If not, what is the routine you are trying to accomplish?
MetaSkinny: Yes, I will be eventually using a form and can set up the requests no problem when I get to that point. For now, I was simply hardcoding everything to test the mail function.
I do not have access to the server ini, nor is there any chance of gaining access.
skypanther: I tried that with their own mail.domain.com, with their host’s mail server’s domain - no luck.
I think they just need to move hosting to me so I can whip this puppy out real easy. But they’re under contract at this other host, and I wonder if their server is messed up.