Problem with my email code where do the email go?

Discussion in 'PHP' started by TheSyndicate, Mar 27, 2007.

  1. #1
    I do not get any returns to my email. I know this sounds funny but i want the email that is not correct to come back to me so i can delete the users.

    this is my code what have i done wrong?

    <?
    $subd = "";
    require_once $subd . "../../includes/sv_config.php";
    require_once $subd . "../../includes/db_connect.php";
    $connector = new DbConnector();
    
    $todaydate=date("d");
    $todaymonth=date("m");
    $todayyear=date("Y");
    $today="$todayyear-$todaymonth-$todaydate";
    $mktod=mktime(0, 0, 0, $todaymonth, $todaydate, $todayyear);
    //$mktoday=mktime(0, 0, 0, $todaymonth, $todaydate, $todayyear);
    $mktoday=mktime(0, 0, 0, $todaymonth, $todaydate-2, $todayyear);
    //echo "$today - $mktod<p>";
    //echo "$today - $mktoday<p>";
    
    $sql="select * from frm_users where login_time='00:00:00' order by userid";
    $res=mysql_query($sql);
    
    while ($row=mysql_fetch_array($res)) {
    	$id=$row["userid"];	
    	$email=$row["email"];	
    	$joindate=$row["joindate"];	
    	$jdchkdate=substr($joindate, 8, 2);
    	$jdchkmonth=substr($joindate, 5, 2);
    	$jdchkyear=substr($joindate, 0, 4);
    	$jdchk="$jdchkyear-$jdchkmonth-$jdchkdate";
    	$mkjdchk=mktime(0, 0, 0, $jdchkmonth, $jdchkdate, $jdchkyear);
    	echo "$id - $email - $joindate<p>";
    	echo "$today - $mktoday : $joindate - $mkjdchk<p>";			
    			if($mkjdchk==$mktoday) {
    
    	$sender_email="support@domainsample.com";
    	$subject = "Have you forgotten your membership?";
    	/* To send HTML mail, you can set the Content-type header. */ 
    	$headers = "MIME-Version: 1.0\r\n";
    	$headers .= "From: domainsample.com <$sender_email>\n";
    	$headers .= "X-Sender: <$sender_email>\n";
    	$headers .= "X-Mailer: e-kort.se\r\n"; 
    	$headers .= "X-MSMail-Priority: High\r\n";
    	$headers .= "X-Priority: 4\r\n";  //1 UrgentMessage, 3 Normal
    	$headers .= "Return-Path: <$sender_email>\n";
    	//Uncomment this to send html format
    	$boundary = uniqid("domainsample.com"); 
    	$headers .= "Content-Type: multipart/alternative" . 
    	"; boundary = $boundary\r\n\r\n"; 
    	$headers .= "This is a MIME encoded message.\r\n\r\n"; 
    	$headers .= "--$boundary\r\n" . 
    	"Content-Type: text/html; charset=tis-620\r\n";
    	$message = "Hello!<p>
    
    It has been a few days now since you signed up @<p>
    
    <a href='http://www.domainsample.com/picture/index.php?cmd=4' target='_blank'>www.domainsample.com</a><p>
    
    You need to enter your validation code to be able to use our community fully.<p>
    
    If you lost your password / activation code you can get a new one here<p>
     
    <a href='http://www.domainsample.com/login.php?page=password' target='_blank'>http://www.domainsample.com/login.php?page=password</a><p>
    
    We hope to see you soon.<p>
    
    The Support team<p>";
    
    		mail($email, $subject, $message, $headers);
    		//echo "Done";
    
    
    			}	
    }
    ?>
    PHP:
     
    TheSyndicate, Mar 27, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    login_time='00:00:00' doesnt sound right, why would you do that ?
     
    krakjoe, Mar 27, 2007 IP
  3. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #3
    No thats ok i know whats thats for. I am looking for the problem why emails never return to me if they are wrong. If i send 100 emails i a day at least one should be wrong but it is not.
     
    TheSyndicate, Mar 27, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    if($mkjdchk==$mktoday) {

    explain that condition ??
     
    krakjoe, Mar 27, 2007 IP
  5. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It doesn't matter anyway... PHP mail function doesn't handle returns as the return happens long, long after the PHP script has finished.

    You're going to need a script that reads an inbox and does some fancy parsing itself, but I can guarantee you that mail(...) won't help in that.
     
    TwistMyArm, Mar 27, 2007 IP
  6. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #6
    no no i would like to get the emails to the same email i am sending from. In other script i get that but there i get none.
     
    TheSyndicate, Mar 27, 2007 IP
  7. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Well, I guess there's a couple of things that could be the problem.

    Firstly, it could be the fact that *no* emails are actually getting sent: that's what krakjoe is working on the assumption of (I assume): so just to see, add an echo after the if comparison that he quoted there.

    Secondly, it could just be that there are *no* incorrect email addresses, right? Unless, of course, you know for sure that that is not the case.
     
    TwistMyArm, Mar 27, 2007 IP
  8. TheSyndicate

    TheSyndicate Prominent Member

    Messages:
    5,410
    Likes Received:
    289
    Best Answers:
    0
    Trophy Points:
    365
    #8
    The emails are going i get them in my test accounts. Or is only me?

    Echo?
     
    TheSyndicate, Mar 27, 2007 IP