Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8880161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:06:51+00:00 2026-06-14T20:06:51+00:00

Apparently my hostgator shared hosting server hangs after the script below runs. Although the

  • 0

Apparently my hostgator shared hosting server hangs after the script below runs.

Although the script returns a message successfully sent, it isn’t sent. The SMTP settings are verified working as I use it throughout my website. I can’t find anymore errors in this document and my host doesn’t seem to have any clue either why it hangs or why it doesn’t send.

Am I overlooking something? Any ideas?

<?php
require_once "Mail.php";
include('../../Redirect_modules.php');

function sendmail($type,$subject,$body)
{
  if($type==1) $WET = DBGet(DBQuery("SELECT * FROM staff"));
  else $WET = DBGet(DBQuery("SELECT * FROM staff where profile='$type'"));  

  $from = "";

  $host = "";
  $username = "";
  $password = "";

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

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

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

  foreach($WET as $e)
  {
    $to = $e['EMAIL'];
    $mail = $smtp->send($to, $headers, $body);

    if (PEAR::isError($mail)) {
      echo("<p>" . $mail->getMessage() . "</p>");
    } else {
      //echo("<p>Message successfully sent!!</p>");
    }
  }
}

function sendsinglemail($to,$subject,$body)
{
  $from = "Your Name";

  $host = "";
  $username = "";
  $password = "";

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

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

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

  if (PEAR::isError($mail)) {
    echo("<p>" . $mail->getMessage() . "</p>");
  } 
  else {
    echo("<p>Message successfully sent!!</p>");
  }

}

if($_REQUEST['modfunc']=='send')
{
  if($_POST['roption2']=='0')
  {
    sendmail($_POST['roption1'],$_POST['subject'],$_POST['message']);       
  }
  else
  {
    sendsinglemail($_POST['roption2'],$_POST['subject'],$_POST['message']); 
  }
}

$RET = DBGet(DBQuery("SELECT * FROM staff")); 
?>

<h2> Communicate with Teachers or Parents individually or by group via Email </h2>
<form action="<?php echo "Modules.php?modname=$_REQUEST[modname]&modfunc=send" ?>"     method=POST>
 <table width="500">
 <tr><td> To:</td> <td><select name="roption1" id="groupselect">
 <option value="1">All Administrators, Teachers and Parents</option> 
 <option value="admin">All Administrators</option>
 <option value="teacher">All Teachers </option>
 <option value="parent">All Parents</option>
 </select> 
  or 
 <select  name="roption2" id="individual">
    <option value="0" SELECTED>Select User</option> 
    <?php foreach($RET as $userdata){ ?>
      <option value="<?php echo $userdata['EMAIL']; ?>"><?php echo    $userdata['FIRST_NAME']." ".$userdata['LAST_NAME']; ?></option>
    <?php } ?>
 </select> 
 </td>
 </tr>
 <tr><td> Subject:</td> <td> <input type="text" name="subject" /> </td></tr>
 <tr> <td> </td> <td>Message: <br/> <textarea cols="60" rows="10" name="message">    </textarea> </td></tr>
  <tr> <td><input type="submit" value="send" name="submit" />
 </table>
</form>
<?php
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T20:06:52+00:00Added an answer on June 14, 2026 at 8:06 pm

    Glaring mistake made by me, the FROM field was not filled correctly and hence causing the hang after a bounceback!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Apparently, indexing a list with attributes returns a list without the attributes. > l
Apparently this problem comes up fairly often, after reading Regular expression to detect semi-colon
Apparently after reading the old title that was Why do questions like is ++i
Let me first say that I am running on a shared linux server with
The web server I usually use was apparently blown out by a storm, and
Apparently there is a method that takes a char and returns a char: http://download.oracle.com/javase/6/docs/api/java/lang/Character.html#toLowerCase(char
Apparently a JSON object can be passed inside a linked script. I'm trying to
Apparently MapReduce queries are one of the slowest things one can do in MongoDB
Apparently when linking a library build with the Intel Composer 12.1 or against the
Apparently, using AttachDbFilename and user instance in your connection string is a bad way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.