Jump to content

vbcoach

Members
  • Posts

    123
  • Joined

  • Last visited

Posts posted by vbcoach

  1. On 3/5/2022 at 9:13 PM, gizmola said:

    Ok, let me clarify a few things for you.

    1. There is no such thing as phpmail.  You are introducing confusion thinking that such a thing exists.
    2. PHP has a mail() function, which is somewhat configurable via the php.ini.  By default it pipes mail input directly to whatever the local "Mail transfer agent" aka "MTA" is.  The MTA is operating system dependent, but it's some server process that implements Simple Mail Transfer Protocol (SMTP) which is the protocol mail *servers* use to send and receive emails.  Whether or not those emails actually get sent as expected or received, after mail has been called, has many complicated issues associated with it, and is the domain of experienced email system administrators.  In your case, that is entirely within the purview of Network Solutions.  I will offer just a few issues:
      1. To send email requires DNS, specifically MX records for a domain.
      2. In most cases systems are not sending email directly out of a specific application server.  They instead are using the hosting companies email servers. 
      3. To send email on behalf of a domain requires at very least SPF, and increasingly DKIM setups for the email servers on behalf of a domain
    3. The network solutions script is a red herring.  We need to see what your script is doing.  There are many ways to send email.  We also need to understand more about these emails you send.
      1. What is the from address?
      2. Is it from you at your domain?
      3. What do the headers look like for the test emails you can send out?
      4. Is NS proxying your emails for you?
      5. What code packages the "html" version
        1. THe RFC's for how emails work has specific requirements for what an email is supposed to look like.  An "html" email is not a replacement for a standard email.
          1. Technically an html email is just a attached version of the email that should be packaged with an original ascii only version.  Email clients then will retrieve the html version and display that.
          2. Many email systems are highly fault tolerant, and not unlike the way browsers will tolerate broken html and still display something for you in most cases, that doesn't mean you should or your software should ignore the standard and correct format for emails. 
            1. It is never correct to take code that would send an html email and then just add html tags to the body and send that instead, even if it has worked for you to some degree in the past. 
            2. Some email systems will reject that email outright and you will likely never know that they were rejected. 
            3. Some mail clients won't work or the email will look bad.  Viewing html emails is actually a choice for the email client.  Some people use clients that don't render html or they intentionally turn it off.  That might be the minority, but it is another reason to have a properly constructed email.

    You really have a number of issues:

    • You have limited control of your hosted environment?
    • You aren't an expert on how email administration works or php
    • You're running a really old script on a version of php that has been End of life for a long time
    • You don't seem to have any test environment, so you're experimenting with your production environment, with limited visibility into that
    • Apparently your script has some bugs, but again we haven't seen it, or any portion of it.

     

    To summarize.

    • Yes you should use PHP 7.4 (at minimum).  That is the *oldest* supported PHP version available.
    • You might very well be better served by using one of the many current supported PHP mail libraries rather than something as low level and hosting dependent as mail().  For example, many libraries actually implement SMTP themselves, and give you a lot more control over the process of sending emails programmatically, while at the same time insuring that the delivered email data is actually compliant with email standards
    • For any email sending you need a good handle on the questions I raised previously (how will you actually "send" email, in terms of what user@domain the email is coming from.  Is this from your domain, and if so, is the email setup for the domain valid and workable.  Anyone can setup something that "delivers" emails via smtp that will promptly be rejected or accepted and deleted with you never being the wiser.
    • The php Composer tool was released a decade ago.  There is no excuse left for a project that is not using composer to manage your dependencies.  This is also why you probably need a dev/test environment within which you can run composer.
      • Composer will download and manage your dependencies.
      • It will build a standards compliant autoloader for your application that you include so that class libraries like phpmailer can be properly autoloaded
    • Porting your email script is probably the path to getting something reliable and supported.

    I hope this helps you start moving yourself in the right direction. If you want to start answering some of the questions I posed, and need help and advice in doing so, feel free to follow up.  Sending email seems simple but it has become a very complicated endeavor over the years, and like many things that seem simple on the surface, have a lot of hidden complexity to them, especially when things go wrong.

    This was one of the most thoughtful, well written responses I have ever had on this forum in all the years that I have been on here.  You are spot-on in regards to my skill set, but I have had to learn everything on my own.  Thank you for your thoughtful (and not demeaning) response.

  2. For anyone who might be reading this using the Network Solutions Shared Hosting platform, the ultimate fix was the mail server security was changed last November and required SSL/TLS now, even though they did not update their own documentation.  Even their own technicians were not aware of this.  The ultimate fix was upgrading PHPMailer to v6.6.0 and changing the port to 587 with TLS (on localhost)

  3. So PHP 7.4 threw too many errors on my site, so I dropped down to PHP 7.0  Took care of  other issues, but now on the test PHPMail script getting this error - I think it has something to do with the headers not being recognized?

    Warning: mail(): SMTP server response: 553 5.0.0 <custserv@networksolutions.com... Unbalanced '<' 500 5.5.1 Command unrecognized: "Content-Type:text/html>" in \\WDP\DFS\30\1\9\6\3007726691\user\sites\xxxxxx.site\www\mailer.php on line 19
    FAILED TO SEND!

    Any thoughts?  Anyone?

  4. Also, what I would like to do now since I have upgraded the PHP to v7.4 is to try the newer PHPMailer v5.6 or v6.x - but I am running a Windows website on NetSol shared hosting platform, so I do not have backend or command-line access like I do on a linux system.  When I look at the PHPMailer code, I do not see files from the documentation like the PHPautoloader.php for example, nor do I see a folder called vendor anywhere?  IU am kind of stumped at this point and really need some help with this ASAP!

    Thanks...

  5. Well what I did was to upgrade php from v5.6 to v7.4 and now nothing works, except for better error messages.

    <html>
    <head>
      <title>PHP Form Mail Test Script</title>
    </head>
    <body>
    <h3>PHP Form Mail Test Script</h3>
    <?PHP
    error_reporting(E_ALL);
    	$email = $_REQUEST['email'];
    	$body = $_REQUEST['body'];
    	$subject = $_REQUEST['subject'];
    	$from = $_REQUEST['from'];
    	$sendusing = $_REQUEST['sendusing'];
    	$usehtml = $_REQUEST['usehtml'];
    
    	if ($sendusing == "mail") {
    		$header = "From: " . $from . "\n";
    		if ($usehtml == "yes") $header .= "Content-Type:text/html\n"; else $header .= "Content-Type:text/plain\n";
    		if (mail($email, $subject, $body, $header))  echo "SUCCESS... Email sent using Mail() function";else  echo "FAILED TO SEND!";
    		echo "<br>" . date('l dS \of F Y h:i:s A') . "<br><br>";
    	} else if ($sendusing == "pear") {
    		if (mail_this($email, $subject, $body, $from))  echo "SUCCESS... Email sent to using PEAR module";else  echo "FAILED TO SEND!";
    		echo "<br>" . date('l dS \of F Y h:i:s A') . "<br><br>";
    	} else {
    		$email = "Type Email Address";
    		$body = "FormMail Test";
    		$subject = "Test Email";
    		$from = "custserv@networksolutions.com";
    		$sendusing = "mail";
    	}
    ?>
    
    <table><form method="post" action="" name="sendmailtest">
    	<tr><td>TO:</td><td><input value="<?PHP echo $email;?>" name="email" size="35"></td></tr>
    	<tr><td>FROM:</td><td><input value="<?PHP echo $from;?>" name="from" size="35"></td></tr>
        <tr><td>Subject:</td><td><input value="<?PHP echo $subject;?>" name="subject" size="35"></td></tr>
    	<tr><td colspan=2>Body:<br><textarea  cols="45" rows="3" name="body"><?PHP echo $body;?></textarea></tr>
    	<tr><td>Send Using:</td>
    	<td><input name='sendusing' value='mail' type='radio'<?PHP if ($sendusing == "mail") echo " checked='checked'";?>><b>Mail() Function</b><br>
    	<input name='sendusing' value='pear' type='radio'<?PHP if ($sendusing == "pear") echo " checked='checked'";?>><b>PEAR Module</b></td></tr>
    	<tr><td>Use HTML <input name="usehtml" value="yes" type="checkbox"<?PHP if ($usehtml == "yes") echo " checked='checked'";?>></td>
    	<td align=right><input name="submit" value="Send Email" type="submit"></td></tr>
    </form></table>
    
    <?PHP
    function mail_this($email, $subject, $body, $from) {
    	include('Mail.php');
    
    	$headers['From']    = $from;
    	$headers['To']      = $email;
    	$headers['Subject'] = $subject;
    	if ($usehtml == "yes") $headers['Content-type'] = "text/html"; else $headers['Content-type'] = "text/plain";
    
    	$params["host"] = "localhost";
    	$params["port"] = "25";
    	$params["auth"] = false;
    	$params["username"] = "username";
    	$params["password"] = "password";
    
    	// Create the mail object using the Mail::factory method
    	$mail_object =& Mail::factory('smtp', $params);
    
    	$mail_object->send($email, $headers, $body);
    
    	if (PEAR::isError($mail_object)) {
      		return false;
     	} else {
      		return true;
     	}
    }
    ?>
    </body>
    <!--
    #######################################################
    ##                                                   ##
    ## NOTE:  This is a Network Solutions Test Script.   ##
    ## Any modifications to this script are not the      ##
    ## responsibility of Network Solutions as this script## 
    ## was generated only to ensure that your service is ##
    ## functioning properly.                             ##
    ##                                                   ##
    #######################################################
    -->
    </html> 

     

    Anyone else care to take a stab at this?

     

    Thanks for trying Ginerjm

  6. Wow!  We are just not on the same page here!  The NS script is only a "test script" to verify that the PHP Mail() service is working.  It send out a test email given the options you enter.  If I "UNCHECK" the send using HTML box, the test script sends out a 'test' email properly and returns a message saying the email was sent successfully.  If I "CHECK" the use HTML box, I still get the same message that the email was sent successfully, but no email is received.  NetSol is obvioulsy blocking HTML emails from being sent somehow.  I just can't figure out what they did on the backend to block HTML emails.

  7. Let's take the confusion out of this, shall we?

    For years and years and years, I have been using the PHPMail script on github.  Been working sending html emails for 7-8 years now without issue.  It stopped sending last November.  Something changed at NetSol and I don't know what it might be?  Some security issue most likely?

     

    Network Solutions placed a test php mail script in my root folder years ago for testing.  It was created by NetSol for NetSol accounts for testing purposes.  That test script has various small options like using PHP Mail() or PEAR module, and also has a checkbox to enable sending as HTML.  This script verified that PHPMail() is working.  With HTML unchecked, the test email sends just fine, and I receive a message stating that the email has been sent successfully.  With the HTML box checked?  Same response, message sent successfully, but no HTML email is ever received.

    Hope this clears things up?

    What have I done?  Remember, nothing in the original PHPMail script (or website) has been changed at all regarding the PHPMail module.  In the TEST script, I tried auth-true and entered the un & pw, and still no HTML mail is ever received.  This is why I came here.  Why is HTML mail suddenly being blocked?
     

  8. I was saying that I was using two scripts.  It's the Network Solution test-email.php script that has the HTML checkbox option.  The PHPMail script I use to send the team receipt page emails already has HTML enabled.  The script returns a message that the email is being sent as usual, but nothing is received via email.

  9. As you may already know, I do not have rights to edit the php.ini code as it is on a shared hosting site, but I will try your suggestion to add these two lines of code and see how the site reacts to it.  I am using the pretty much standard PHPMail script.  This script has served me well for the past 7-8 years or so and was working quite fine, actually.  That is up until November of last year.  The script still works, but only without HTML.  Don't know if NetSol suddenly requires SMTP Auth now or what?  Let me see what happens with your suggested changes...

  10. Hello all. Need assistance on something I think should be a simple fix . I am using a PHP Mailer app on my website hosting, which is Network Solutions, I know, shame on me. Very recently Network Solutions stopped sending my HTML-encoded emails for some unknown odd reason. Using their PHP mail testing application, those emails with non-HTML are working and sending just fine, but as soon as I try to send one with HTML(isHTML=True) encoding, it never sends, but I also don't get an error. The program tells me the email was sent successfully.

    Can anyone help me out here? 

  11. I am reading the replies.  You are writing to me code that I am unfamiliar with.  When you ask me to place this information in my code to see if it works, that's what I do.  If something is missing from your example, it doesn't help me fix the issue, or learn the how and why you did it this way.  So very humbly, what is missing here?

  12. Oh, I might add that what I am looking for overall here is that if the team captain select a tshirt at the time of registration, I would like it to be "SELECTED" and displayed here.  If the field is blank, then I would like for all the tshirt options be be available to be chosen.  Hope that helps?

  13. Hello Psycho, thanks for your very quick response.  I know my code is older, but I inherited it.  As I try to wrap my head around what you wrote, one thing that was apparent as I entered the code was the HTML portion seems to be mission some type of variable statement.  The <select name="size" id="size">

    <?php echo ; ?>
    </select>

    is not actually echoing anything.  What's missing here?

  14. Hello all.  I am having an issue displaying data in a form that IF EXISTS (not blank) will cause that option to be selected.  The looping itself works.  The variable called into the form works.  Just can't seem to get the form to SELECT the correct variable.

    <select name="size" id="size">
                  
      <?php  while ($lrow = mssqlfetchassoc($tres))  
    	 { 
                 ?>
                  
          <option value="<?php echo $lrow['ts_id'];?>">
           <?php if($lrow['tsdescription'] == $info['size']) echo 'selected';?>
            <?php echo "$lrow[tsdescription]";?> </option>      
                        
               <?php  
    		 }  
     		 ?>
        </select>
    

    So this is displaying the team captain's TShirt size from a database (mssql).  In the database the field is called tsdescription.  For sake of argument, let's say the tshirt description is "Blue 2XLarge".  This variable exists and is passed into the form for updating by the team captain, if necessary.

     

    The loop works, as it loops through all the tshirt options (107 in total) and works as a pull-down menu.  Somehow my IF statement doesn't work.  What I am looking for is for PHP to "find" the existing tshirt description 'tsdescription' in the loop statement, and if found, cause it to be "Selected".  

     

    The $info are the variables for the form when the captain's information page is loaded.  So far, by itself, the $info['size'] returns the correct tshirt.  "by itself" the dropdown works.  Thus, something must be amiss in my IF statement.

     

    Can anyone help direct me to what I am missing to make this work?  Thanks in advance.

     

    -J

  15. Let me try this again.  In the middle of my page, there is a form statement that creates buttons to push.  I would like to create an "IF" statement to display or not display these buttons.  In my code I use "session" but it really means "season" as in Spring or Summer.  So if the "season" = Summer, then display these buttons.  The basic code for these buttons looks like this:

                   <?php
    			if($row['ptsordered'] == '')
    			{
    			?>
                      <form name="player<?= $row['p_id'] ?>" action="editPlayer.php" method="get">
                      <input type="hidden" name="p" value="<?= $row['p_id'] ?>">
                      <input name="Submit" type="submit" class="button" value="Edit">
                  </form>
                <?php
    			}
    			?>
                </td>
          
                 <td><form name="del_player<?= $row['p_id'] ?>" action="remPlayer.php" method="post" onSubmit="return(confirm('Are you sure you want to delete <?= $row['name']?>?\n\nThis cannot be reversed'))">
                      <input type="hidden" name="p" value="<?= $row['p_id'] ?>">
                      <input type="hidden" name="t" value="<?= $id ?>">                  
                      <input name="Submit" type="submit" class="button" value="Remove">
                  </form></td>
                </tr>
                <?php $i++; } ?>
    

    So I need help with a PHP statement that says if "session = 'Summer" then ..." displays the buttons, if not, the buttons are not displayed.  Does this make sense now?  Sorry for the confusion.

  16. Hello all.

     

    I have a sports league website that is used for captains to be able to view and manipulate certain items displayed in a form format.  I want to be able to hide or disable two buttons in the form; the Edit and Remove buttons based on a simple IF statement.  However I am not quite being able to make this happen, as the form is outside of the PHP statement.

    <body> 
    
    <table width="800" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="images/BBV_CP_top.jpg" width="800" height="200"></td>
      </tr>
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="2">
          <tr>
            <td width="6%" class="menu"><a href="home.php"> Home</a> </td>
            <td width="9%" class="menu">
    		<?php if  {echo "<a href=editTeam.php> Edit Team </a>";}?></td>
            <td width="12%" class="menu">
            <?php if ($team[session] == 'Summer') {echo "<a href=addPlayer.php> Add Player </a>";}?></td>
            <td width="63%" class="menu"><br>
    		<?php if ($team[session] == 'Summer') {echo "<a href=editInfo.php> Edit My Information </a>";}?></td>
            <td width="10%" class="menu"><a href="logout.php">Log Out </a></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><table width="765"  border="0" cellspacing="1" cellpadding="1">
          <?php  if($info['feepaid'] == 'n')
    	  { ?>
    	  <tr>
            <td colspan="2" align="left" valign="top"> </td>
            </tr>
    	<?php }?>	
          <tr>
            <td width="37%" align="left" valign="top"><br>
              <table width="100%"  border="0" cellpadding="2" cellspacing="0" class="grey2px">
                <tr>
                  <td colspan="2" class="dk_greyTxt"><h3><strong>Captain's Information</strong></h3></td>
                  </tr>
                <tr>
                  <td width="27%" class="dk_greyTxt"><strong>Name</strong></td>
                  <td width="73%"><?php echo $info['cptname']; ?> </td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>Address</strong></td>
                  <td><?php echo $info['address']; ?><br>
                      <?php echo "$info[city], $info[state] $info[zip]"; ?> </td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>Phone</strong></td>
                  <td><?php echo $info['phone'] ?></td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>E-mail</strong></td>
                  <td><?php echo $info['email'] ?></td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>Shirt Size </strong></td>
                  <td><?php echo $info['size'] ?></td>
                </tr>
              </table>
              <br></td>
            <td width="63%" rowspan="2" align="left" valign="top"><br>
              <table width="100%" cellpadding="1" cellspacing="0" class="grey2px">
                <tr class="dk_greyTxt">
                  <td colspan="6"><h3><strong>Player's Information</strong></h3></td>
                  </tr>
                <tr class="dk_greyTxt">
                  <td width="21%"><strong>Name</strong></td>
                  <td width="23%"><strong>E-mail</strong></td>
                  <td width="21%"><div align="center"><strong>Shirt Size</strong></div></td>
                  <td width="19%"> </td>
                  <td width="16%"> </td>
                </tr>
                <?php 
    		$i=0;
    		while($row = mssqlfetchassoc($players))
    		{
    		 
    		?>
                <tr <?php if($i%2 == 0) echo "class='altbg'";?> >
                  <td><?php echo $row['name'] ?></td>
                  <td><?php echo $row['email'] ?></td>
                  <td align="center"><?php echo $row['pshirt'] ?></td>
                  <td><form name="del_player<?= $row['p_id'] ?>" action="remPlayer.php" method="post" onSubmit="return(confirm('Are you sure you want to delete <?= $row['name']?>?\n\nThis cannot be reversed'))">
                  </form></td>
                  <td><form name="player<?= $row['p_id'] ?>" action="editPlayer.php" method="post">
                  </form></td>
                </tr>
                <?php $i++; } ?>
              </table></td>
          </tr>
          <tr>
            <td align="left" valign="top"><br>
              <table width="100%"  border="0" cellpadding="2" cellspacing="0" class="grey2px">
                <tr>
                  <td colspan="2" class="dk_greyTxt"><h3>Team Information </h3></td>
                  </tr>
                <tr>
                  <td width="27%" class="dk_greyTxt"><strong>Name</strong></td>
                  <td width="73%"><?php echo $team['teamname']; ?></td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>League</strong></td>
                  <td><?php echo "$team[night] $team[type] $team[size]s"; ?></td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>Division</strong></td>
                  <td><?php echo $team['division'] ?></td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>Shirt Color </strong></td>
                  <td><?php echo $team['shirtcolor'] ?></td>
                </tr>
                <tr>
                  <td class="dk_greyTxt"><strong>Registration Date </strong></td>
                  <td><?php echo $team['reg_start'] ?></td>
                </tr>
                <?php
    	  if($info['feepaid'] == 'n')
    	  {
    	 ?>
                <?php
    	  }
    	  else
    	  {
    	 ?>
                <tr>
                  <td class="dk_greyTxt"><strong>Registration Completed </strong></td>
                  <td><?php echo $team['reg_done'] ?></td>
                </tr>
                <?php
    	}
    	?>
       <?php mssqlclose(); ?>
    
                <tr>
                  <td class="dk_greyTxt"><strong>Record </strong></td>
                  <td> </td>
                </tr>
                
              </table></td>
            </tr>
        </table></td>
      </tr>
    </table>
    <br>
    </body>
    

    Under the Players table, there is an Edit and Remove button.  I would like to hide this button based upon a PHP statement that looks a bit like this:  <?php if ($team[session] == 'Summer')...  Basically we are in the Spring session, thus at this point in the season, I do not want teams to be able to edit, add, or remove any player information.  However the same database is used for both Spring and Summer registrations.

     

    So any help incorporating this php statement to hide these buttons would be greatly appreciated!  -J

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.