Current location: Hot Scripts Forums » Programming Languages » PHP » Pear email not working!


Pear email not working!

Reply
  #1 (permalink)  
Old 10-01-11, 07:04 PM
phphelpme phphelpme is offline
Newbie Coder
 
Join Date: Jul 2010
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Pear email not working!

this is a forgot password page and this email script will not send , please help
PHP Code:

<?php

$emailcut 
substr($email04); // Takes first four characters from the user email address
                
$randNum rand(); 
                
$tempPass "$emailcut$randNum"
                
$hashTempPass md5($tempPass);

                @
mysql_query("UPDATE myMembers SET password='$hashTempPass' where email='$email'") or die("cannot set your new password");

                include(
'Mail.php');
        include(
'Mail/mime.php');
 
        
// Constructing the email
        
$sender "Social network";                                            // Your email address
        
$recipient "$email";                               // The Recipients name and email address
        
$subject "Reset Your Password";                                                // Subject for the email
        
$text 'This is a text message.';                                      // Text version of the email
        
$html "<html><body><div align=center><br>----------------------------- New Login Password --------------------------------<br><br><br>
                Your New Password for our site is: <font color=\"#006600\"><u>
$tempPass</u></font><br><br />
                </div></body></html>"
;      // HTML version of the email
        
$crlf "\n";
        
$headers = array(
                        
'From'          => $sender,
                        
'Return-Path'   => $sender,
                        
'Subject'       => $subject
                        
);
 
        
// Creating the Mime message
        
$mime = new Mail_mime($crlf);
 
        
// Setting the body of the email
        
$mime->setTXTBody($text);
        
$mime->setHTMLBody($html);
 
        
// Add an attachment
        
 
        // Set body and headers ready for base mail class
        
$body $mime->get();
        
$headers $mime->headers($headers);
 
        
// SMTP authentication params
        
$smtp_params["host"]     = "smtp.gmail.com";
        
$smtp_params["port"]     = "587";
        
$smtp_params["auth"]     = true;
        
$smtp_params["username"] = "activate.social@gmail.com";
        
$smtp_params["password"] = "pass";
 
        
// Sending the email using smtp
        
$mail =& Mail::factory("smtp"$smtp_params);
        
$result $mail->send($recipient$headers$body);

 if (
PEAR::isError($mail)) {
   
$outputForUser '<font color="#FF0000">Password Not Sent.<br /><br />
                                                                  Please Contact Us...</font>'
;
  } else {
  
$outputForUser "<font color=\"#006600\"><strong>Your New Login password has been emailed to you.</strong></font>";
  }
 
                
                
     }

} else  {
 
   
$outputForUser 'Enter your email address into the field below.';

}



?>
Reply With Quote
Reply

Bookmarks

Tags
css, javascript, mysql, php, php & mysql developer


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Freeze columns in a table Rita Negi Script Requests 1 09-01-09 08:23 AM
Formmail not working on alternative email ginny1000 Perl 0 07-29-09 03:30 AM


All times are GMT -5. The time now is 08:51 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.