Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm starting to not like that much. I've used them for years, but mainly for simple sites without much need for configuration. I know there are better hosting companies out and I may go seeking them.

The problem here is that on my Local XAMPP server (sitting on a network with Comcast ISP), I have a PHP script that uses PEAR::Mail to send mail using MIME. The script works find locally with either and corresponding credentials and with corresponding credentials, using appropriate ports, etc.

1and1 tells me that I have to change the MX record on the domain where this script runs in order to make this work. This doesn't make sense to me.


PEAR Version: 1.5.0
PHP Version: 4.4.9
Zend Engine Version: 1.3.0

I understand that the systems (servers) are very much different (thanks to nojak for bringing this up; my original question was vague). The OSes, PHP versions, and probably many other configurations are quite different. My main question is if PEAR and PHP have the email functionality in both cases and my script works on my local setup, what kind of things will make the 1and1 servers not work? I'm looking for other troubleshooting to try.

My apologies in advance for my ignorance. Thanks for the help in advance.


Here is my function:


function send_form_mail($body) {

    $from = "<***>";
    $to = "<***>";
    $subject = $body[0];
    $host = "";
    $port = "587";
    $username = "***";
    $password = "***";

    $headers = array(
        'From' => $from,
        'To' => $to,
        'Subject' => $subject

    $smtp = Mail::factory('mail', array(
        'host' => $host,
        'port' => $port,
        'auth' => true,
        'username' => $username,
        'password' => $password

    $text_field_array = array(

    for ($i = 1, $size = sizeof($body) + 1; $i < $size; $i++) {      
        $text_body .= $text_field_array[$i] . $body[$i] . '\n';

    $html_field_array = array(

    for ($i = 1, $size = sizeof($body) + 1; $i < $size; $i++) {          
        $html_body .= $html_field_array[$i] . $body[$i] . '<br />';

    $mime = new Mail_mime();
    $mime -> setTXTBody($text_body);
    $mime -> setHTMLBody($html_body);

    $email_body = $mime -> get(); 
    $headers = $mime -> headers($headers);

    $mail = $smtp -> send($to, $headers, $email_body);

    if (PEAR::isError($mail)) {
        echo("<p>We've encountered and an error: " . $mail -> getMessage() . "</p>");

Please note that I starred out sensitive characters in function above.

Here are the main points 1and1 shared with me:

  1. Told me PEAR Mail wouldn't work
  2. I tested this and it did, so the first tech was incorrect
  3. Via email, got a test script from them using PEAR
  4. Tested it and it worked, but no SMTP
  5. Then, they gave me other SMTP servers
  6. Tested these and they worked as well, but still without SMTP
  7. I asked why couldn't I just use other email servers, like
  8. Then, they told me I had to change my MX record
  9. I then asked why since I didn't want to do this yet and that I wanted to just use another SMTP server
  10. They told me that this wasn't possible
  11. I began getting confused and came here for help
share|improve this question
For one, you're not running the same virtualized environment at home, and probably not even the same Unix/Linux kernel nor distro. Don't just automatically assume that because it works on you "home" development environment, that it will work on any and every other server setup just because you're using the same types packages. If your device environment was ABSOLUTELY IDENTICAL in every way, including using the same backend setup and virtualization software, then you probably be safe to assume it would work. But not in any other case . – nojak Aug 30 '12 at 23:06
That makes sense, and I understand this concept. I was not assuming the environments were identical; rather, I would like to try to figure out why this particular process isn't working. I have identified several inconsistencies already, like PHP version, for example. I will edit to be more clear. – nicorellius Aug 30 '12 at 23:35
What exactly did 1and1 tell you, and how exactly did you configure PHP and the server that's "not working"? – Michael Hampton Aug 30 '12 at 23:39
They told me several things, all of which I tried, one by one... First, I called them and the tech told me PEAR Mail wouldn't work with my script. I then SSH-ed into the server and saw that the PEAR packages are indeed installed, but are older versions. Next, via email, they referred me to a script that used PEAR and I tried it and it worked, but it didn't use SMTP authentication. And the list goes on. I think I should edit the post again with major points instead of listing everything in this comment. Thanks for the guidance. – nicorellius Aug 30 '12 at 23:45
Can you elaborate on what you mean when you say "tested and it worked, but no smtp"? If the script doesn't work with smtp, then it doesn't work. Or do you mean it will communicate with the smtp servers, but not pass credentials to it or fail to verify credentials? Also, when you say they gave you other smtp servers, do you mean they installed other MTAs, or something told you different smtp servers to try connecting to? – nojak Aug 31 '12 at 2:18
up vote 1 down vote accepted

This was solved by adjusting the paths of PEAR on the server. I actually installed it in another directory and pointed my functions there.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.