• Perhaps not strictly a WordPress issue…but perhaps it is.

    We suddenly began having issues with the “unsubscribe” on a site. It was working find up to a few days ago. Here are the details:

    The page uses the PHP mail() function to send an unsubscribe request to one of our email boxes and an unsubscribe confirmation to the person requesting the unsubscribe. It worked find until a couple of days ago. We at first thought perhaps it was the PHP mail() function not working (perhaps due to a change in the PHP.ini file) but another page on the website which uses the PHP mail() function is working correctly.

    The data is being process correctly as we can see the unsubscribe data in the database.

    As far as I can tell the PHP code on the page for processing the email is not dependent on any other page or plug-in.

    There are NO PHP errors showing up in the error log.

    The only changes that have been made recently is that earlier this week someone updated several plug-ins. However, I have restored the prior versions of the plug-ins without any restoration of the correct functioning of the page in question. The only other possible change would be if WordPress Core was updated sometime this week (automatic updates is activated on the site). I have looked but do not find where I can determine the release dates for various versions so I do not know at the moment if that is a factor or not.

    The code in question follows below. Any help anyone could offer (ASAP) would be greatly appreciated:

    <?php
    session_start();
    /**
    Template Name: Unsubscribe
     */ ?>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    	<head>
    	<meta http-equiv = "Content-Type" content = "text/html; charset=UTF-8" />
    	<title>
        <?php wp_title('&laquo;', true, 'right'); ?>
        <?php bloginfo('name'); ?>
        </title>
    	<?php
    	wp_head();
    ?>
    <?php include("libmail_html.php"); ?>
    	<link type = "text/css" rel = "stylesheet" href = "<?php bloginfo('stylesheet_directory'); ?>/layout.css"/>
    	<link type = "text/css" rel = "stylesheet" href = "layout.css"/>
    	<link type = "text/css" rel = "stylesheet" href = "<?php bloginfo('stylesheet_directory'); ?>/css/text.css" />
    	<link type = "text/css" rel = "stylesheet" href = "<?php bloginfo('stylesheet_directory'); ?>/css/misc.css"  />
    	<link type = "text/css" rel = "stylesheet" href = "<?php bloginfo('stylesheet_directory'); ?>/nav.css" />
        <script type = "text/javascript" src = "<?php bloginfo('stylesheet_directory'); ?>/js/gen_validatorv31.js"></script>
    	<?php
    	if($_POST['txt_email']!='')
    	{
    			$email_id=$_POST['txt_email'];
    			$select_declindquery1=mysql_query("select email from unsubscribe_email where email='".$_POST['txt_email']."';");
    			$select_declindquery_result1=mysql_fetch_array($select_declindquery1);
    			$decline_ans1=$select_declindquery_result1['email'];
    
    			if($decline_ans1=='')
    		{
    		//	$select_declindquery=mysql_query("select * from wp_sean_attendees where email='".$_POST['txt_email']."';");
    		//	$select_declindquery_result=mysql_fetch_array($select_declindquery);
    //			$decline_ans=$select_declindquery_result->status_type;
    
    			$time_now=time();
    			$declind_query=mysql_query("insert into unsubscribe_email values('','".$_POST['txt_email']."',$time_now);");
    //			$declind_query=mysql_query("UPDATE wp_sean_attendees SET status_type='declined',time=$time_now WHERE email='".."';");
    			//$subject_decline = "Unsubscribe";
    			//$headers_decline  = "From:info@theitsummit.com\r\n";
    			//$headers_decline.= 'MIME-Version: 1.0' . "\r\n";
    			//$headers_decline.= 'Content-Type: text/html; charset=utf-8' . "\r\n";
    			//$to_decline='ajs@theitsummit.com';
    			//$to_decline='vadivel@vinsinfo.com';
    			//$message_decline=$_POST['txt_email'];
    			//$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
    				$mail_id=$_POST['txt_email'];
    				$m= new Mail; // create the mail
    				$m->From("info@theitsummit.com");
    				$m->To("ajs@theitsummit.com");
    				$m->Subject("Unsubscribe");
    				$m->Body($mail_id);	// set the body
    				$m->Priority(2) ;	// set the priority to Low
    				$m->Send();
    
    				$n= new Mail; // create the mail
    				$n->From("info@theitsummit.com");
    				$n->To($mail_id);
    				$n->Subject("Unsubscribe");
    				$n->Body("You have successfully unsubscribed  from future communication of The IT Summit.");	// set the body
    				$n->Priority(2) ;	// set the priority to Low
    				$n->Send();
    			//$subject_decline_to = "Unsubscribe";
    			//$headers_decline_to  = "From:info@theitsummit.com\r\n";
    			//$headers_decline_to.= 'MIME-Version: 1.0' . "\r\n";
    			//$headers_decline_to.= 'Content-Type: text/html; charset=utf-8' . "\r\n";
    			//$to_decline='mkh@theitsummit.com';
    			//$to_decline_to=$_POST['txt_email'];
    
    			//$message_decline_to=" You have successfully unsubscribed  from future communication of The IT Summit.";
    			//$q_to=mail($to_decline_to,$subject_decline_to,$message_decline_to,$headers_decline_to);
    			//$q=mail($to_decline, $subject_decline, $message_decline, $headers_decline);
    
    			echo '<script language="javascript" type="text/javascript">window.location.href="http://www.theitsummit.com/unsubscribe/?status=declined";</script>';die;
    
    		}
    		else{
    				 $_SESSION['email_user']="You have been Already Unsubscribed from any future promotional e-mails from The IT Summit..";
    	  			echo '<script language="javascript" type="text/javascript">window.location.href="http://www.theitsummit.com/unsubscribe/?data=error";</script>';
    
    		}
    	}
    
    	?>
    <script language="javascript" type="text/javascript">
    function IsvalidEmail(email) {
    	var str=email;
    	var flag=true;
    	var at="@";
    	var dot=".";
    	var lat=str.indexOf(at)
    	var lstr=str.length
    	var ldot=str.indexOf(dot)
    	if(str=='') {
    		flag=false;
    	}
    	if (str.indexOf(at)==-1) {
    		flag=false;
    	}
    	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
    		flag=false;
    	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
    		flag=false;
    	if (str.indexOf(at,(lat+1))!=-1)
    		flag=false;
    	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
    		flag=false;
    	if (str.indexOf(dot,(lat+2))==-1)
    		flag=false;
    	if (str.indexOf(" ")!=-1)
    		flag=false;
    	 if(flag)
    		return true;
    	 else
    	 return false;
    }
    function validation()
    {
    	var frm=document.frm_email;
    	var str="";
    	if(frm.txt_email.value=="")
    	{
    		str+="Enter the E-mail Address";
    	}
    	if(frm.txt_email.value!="")
    		{
    			if(!IsvalidEmail(frm.txt_email.value)) {
    				str+="Enter the Valid E-mail Address";
    			}
    		}
    
    	if(str!=''){
    			alert(str);
    			return false;
    	}
    	else{
    		frm.submit();
    		return true;
    	}
    
    }
    </script><noscript></noscript>
    	</head>
    
    	<body>
    
    	<?php if($_GET['status']=='')
    	{	?>	
    
    <table class = "layPage">
          <tr>
        <td class = "layHeader"><?php include("header.php"); ?>
    		<form name="frm_email" id="" action="#" method="post" enctype="multipart/form-data">
              <table border="0" cellpadding="0" cellspacing="0" width="1000">
            <tbody>
                  <tr>
                <td colspan="2"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/home_banner.jpg" border="0"></td>
              </tr>
                </tbody>
          </table>
              <br>
              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
              <div class="events_title_text">
            <?php the_title(); ?>
          </div>
              <br />
              <table width="100%" border="0" cellspacing="1" cellpadding="5">
            <tr>
                  <td width="83%"><div class="events_body_text">
                      <?php the_content('Read the rest of this entry &raquo;'); ?>
                      <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
                      <?php endwhile; endif; ?>
    
    					<table border="0" width="50%" cellpadding="0" cellspacing="0" align="center">
    					<tr align="center">
    						<td colspan="2">
    						<?php if($_GET['data']=='error') {?>
    						<span style="color:red;"><?php echo  $_SESSION['email_user'];
    
    					$_SESSION['email_user']="";
    
    						?></span>
    						<?php } ?>
    						</td>
    					</tr>
    					<tr height="20">
    						<td colspan="2"></td>
    					</tr>
    					<tr>
    						<td>Please enter your E-mail address</td><td><input type="text" title=" " name="txt_email" id="txt_email"/></td>
    					</tr>
    					<tr height="20">
    						<td colspan="2"></td>
    					</tr>
    					<tr>
    						<td colspan="2" align="center"><input type="button" name="cmd_submit" title=" " value="Submit" onclick="javascript:return validation();"/></td>
    					</tr>
    					</table>
    		<?php }
    						else
    						{?>
    						<table class = "layPage">
          <tr>
        <td class = "layHeader"><?php include("header.php"); ?>
              <table border="0" cellpadding="0" cellspacing="0" width="1000">
            <tbody>
                  <tr>
                <td colspan="2"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/home_banner.jpg" border="0"></td>
              </tr>
                </tbody>
          </table>
              <br>
              <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
              <div class="events_title_text">
            <?php the_title(); ?>
          </div>
              <br />
              <table width="100%" border="0" cellspacing="1" cellpadding="5">
            <tr>
                  <td width="83%"><div class="events_body_text">
                      <?php the_content('Read the rest of this entry &raquo;'); ?>
                      <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
                      <?php endwhile; endif; ?>
    							<table border="0" width="100%" cellpadding="0" cellspacing="0" style="text-align:center;">
    		<tr height="30">
    		<td></td>
    		</tr>
    		<tr>
    			<td><b style="color:red;">You have been Unsubscribed from any future promotional e-mails from The IT Summit.</b></td>
    		</tr>
    		</table>
    		<?php } ?>
    
                    </div>
                <br />
              </td>
                </tr>
          </table></td>
      </tr>
          <tr>
        <td class = "layFooter"><?php include("footer.php"); ?></td>
      </tr>
        </table>
    				  </form>
    
    <!-- BEGIN ProvideSupport.com Visitor Monitoring Code -->
    <div id="ci9hh3" style="z-index:100;position:absolute"></div>
    <div id="sd9hh3" style="display:none"></div>
    <script type="text/javascript">var se9hh3=document.createElement("script");se9hh3.type="text/javascript";var se9hh3s=(location.protocol.indexOf("https")==0?"https":"http")+"://image.providesupport.com/js/theitsummit/safe-monitor.js?ps_h=9hh3&ps_t="+new Date().getTime();setTimeout("se9hh3.src=se9hh3s;document.getElementById('sd9hh3').appendChild(se9hh3)",1)</script>
    <noscript>
        <div style="display:inline"><a href="http://www.providesupport.com/?monitor=theitsummit" ><img src="<?php bloginfo('stylesheet_directory'); ?>/images/theitsummit.gif" border="0"></a></div>
        </noscript>
    <?php
    	wp_footer();
    ?>
    </body>
    </html>
  • The topic ‘Mail issue’ is closed to new replies.