Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    19

    Unanswered: email cannot find mailserver

    I am using a script that emails me from the WEB page. When I ran it, I got a message "Mail(): Failed to mailserver at "localhost" port 25, verify your "SMTP" and smtp_port" settings in php.ini or use ini_set()...

    After doing some checking and reading, I found our WEB server does not have a mailserver. We have another computer that has the mailserver on it.

    The question I have is:

    can the script refer to the other server for the email part of the script?

    or do I really have to change the php.ini file in the web server to point to the mailserver?

    Richard M

  2. #2
    Join Date
    Jan 2004
    Location
    India
    Posts
    168
    Try doing this if you have the problem if the mail(). Some time the sendmail_path would be send to a wronge path.
    If you want to change the location of the mailserver you can change that in the $MP variable.

    // Configuration
    $announce_subject = "Message From Our Web Site";
    $announce_from_email = "editor@somesite.com";
    $announce_from_name = "Our Site";
    $announce_to_email = "listaddr@listhost.com";
    $body = "Announcement. Our site has a special offer today. Please visit. Thank you.";
    $MP = "/usr/sbin/sendmail -t";
    $spec_envelope = 1;
    // Access Sendmail
    // Conditionally match envelope address
    if($spec_envelope)
    {
    $MP .= " -f $announce_from_email";
    }
    $fd = popen($MP,"w");
    fputs($fd, "To: $announce_to_email\n");
    fputs($fd, "From: $announce_from_name <$announce_from_email>\n");
    fputs($fd, "Subject: $announce_subject\n");
    fputs($fd, "X-Mailer: PHP4\n");
    fputs($fd, $body);
    pclose($fd);

    Try this this would work

    Regards
    Rajesh
    Freelance and Technology Consultant
    -------------------
    Dreams are for ever
    -------------------

  3. #3
    Join Date
    Aug 2003
    Posts
    19
    Just got back to work today and saw your message. At the same time our IT person corrected the problem with the two servers and now I got email privilages. Thanks for the reponse.

    Richard M

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •