PHP mail() not working

Category: Website

gfoxapus
Asked:
2013-04-23 1:21 pm EST

Hits: 625
A colleague asked me to upload a simple PHP script to my server for testing.

<?php
$to = $_REQUEST['to'];
$subject = $_REQUEST['subject'];
$message = $_REQUEST['message'];
mail($to, $subject, $message);
?>

The script collects values from a form and works fine on his server but not on my inmotion server. Is there some global setting that would prevent this script?

You must login before you can ask a follow up question.

You must login before you can submit an answer.

OTHER ANSWERS

0

jamesr
Staff
5,889 Points
2013-04-23 2:13 pm EST
Thank you for your question gfoxapus!

I tested your script by removing the &_REQUEST's and filling in plain text variables. It appears the problem is with your form posting the info through teh browser. Below is an excerpt of what I used with the exception of the email address

$to = 'your@email.com';
$subject = 'Hello World!';
$message = 'Body of the email.';

mail($to, $subject, $message);
?>

Check your Form if its posting the variables. Please see the following article for more information on setting up a PHP email form.

How to create a custom PHP contact form

Using the PHP mail() Function to send emails from a form

Best regards,
James R

You must login before you can post a comment about this answer.

I tried several things including removing the variables and then I checked my main email account associated with my inmotion account and found a slew of returned email:

Your access to this mail system has been rejected due to the sending MTA's
poor reputation. Please reference the following URL for more information:
http://www.senderbase.org/search?searchString=70.39.149.209 If you believe that
this failure is in error, please contact the intended recipient via alternate
means.

I'm going to try something else for now. Thanks anyway.
gfoxapus
8 Points
2013-04-23 3:25 pm EST
Hello Gfoxapus,

The current suggestion is to change the variable of the "from" email address to a local mail address . This will help prevent the issue you're trying to deal with (suggestion came from a systems person here). I also will submit a ticket in your name regarding the server reputation. Unfortunately, this is one of those issues where we're fighting spammers on server level and the best thing that can be done to clear the server reputation is to set the server to a new IP address.

You can find more information on PHPmail here:

Using phpMailer

I hope this hopes to resolve your problem! If you're still having issues with it, please let us know.

If you have any further questions, please contact technical support available 24 hours a day / 7 days a week.

Regards,

Arnel C.
Community Support
Arn
18,486 Points
Staff
2013-04-23 3:51 pm EST
Like this Question?

Related Articles

It looks like there are no related articles.
Would you like to ask a question about this page? If so, click the button below!
Ask a Question

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!