Failed to connect to mail server error for mailing list using PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • valeberry
    New Member
    • May 2007
    • 7

    Failed to connect to mail server error for mailing list using PHP

    Code:
     //Index.php 
    <html><head><title>Mailing List Administration</title></head><body>
    <br>
    <center><H1>Mailing List Administration</H1></center>
    Send an email to a mailing list:
    <form method=post action="sendemail.php3">
    <table><tr><td>
    <b>From Address:</b>
    <input type=text name="From" size="40" value="">
    <br>
    <b>Subject:</b><input type=text name="Subject" size="40">
    </td><td><table cellspacing=15><tr><td valign=top>
    <b>List:</b> 
    </td><td>
    <select name="List" size=4>
    <? 
    $groups = file("lists.txt"); 
    for ($index=0; $index < count($groups); $index++)
    {
    $grouplist = split("\|", chop($groups[$index]));
    ?>
    <option value="<? echo $grouplist[1] ?>"
    <? if ($index==0)
    {echo "selected";} ?>
    <? echo $grouplist[0] ?><br>
    <?
    }
    ?>
    </select></td>
    <td valign=top><b><a href="newlist.php3">Make a new list.</a></b>
    <br><a href="addnames.php3">Add names to a list</a>.
    <br><a href="picklist.php3">Edit/Delete names</a>.
    <br><a href="data.txt">View Send Log</a>.
    <br><a href="autoresponder.php3">View/Edit Autoresponder</a>.
    </td></tr></table>
    </td></tr></table>
    Type or paste your message below:
    <br><textarea cols=50 rows=10 name="Body"></textarea>
    <br><br>
    <input type="submit" name="Submit" value="Send Mail">
    </form>
    <br>
    </body></html>
     
    //send email.php
    <html><head><title>Updating file....</title></head><body>
    <?
    $addresses = file("lists/$List");
    for ($index=0; $index < count($addresses); $index++)
    { 
    mail("$addresses[$index]","$Subject",
    "$Body","From: $From\nReply-To: $From");
    }
    $myfile = fopen("data.txt","a");
    fputs($myfile,$Subject."\t".date("dS of F Y h:i:s A")."\t".$List."\n");
    fclose($myfile); 
    ?>
    Your message was sent!
    <br><br>
    <a href="index.php3">Home</a>.
    </body></html>
    Error message was a warning.

    Here's printscreen of the error msg.
  • ak1dnar
    Recognized Expert Top Contributor
    • Jan 2007
    • 1584

    #2
    Is it a Error message? when its getting?

    Comment

    • valeberry
      New Member
      • May 2007
      • 7

      #3
      Originally posted by ajaxrand
      Is it a Error message? when its getting?
      Yes.
      It seems like I hav to configure some port in outlook express.
      Howeer, I'm unsure how to do so.

      Comment

      • ak1dnar
        Recognized Expert Top Contributor
        • Jan 2007
        • 1584

        #4
        PHP mail() function allows you to send mails over a Configured SMTP server.There is no relation with outlook and its ports with php mail.
        If you trying to send mails over your Local web server refer to the php.ini file for the SMTP configuration.
        Or your web server is a Internet based one check with your vendor whether php mail is enabled or not.

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          You will need to set up an SMTP server, and configure PHP to work with it before mail() will function correctly.

          Comment

          Working...