application/controllers/Auth.php
/* function for sending email for forgot password */
function for sending email for forgot password
function for sending email for forgot password
function sendMail($email,$link,$firstname,$dummyPassword = NULL)
	{	
		if(!$dummyPassword){
			$forgotPassword = '<p>If you did not request a password change, please disregard this message.<br><br></p>';
		}else{
			$forgotPassword = '';
		}
		$msg= '<html>
		              <head></head>
		                <body style="color: black;">
		                	<p>Dear User, <br>
							Isn’t it exciting searching for a new home? Well, reset password is a small part of that fun!  Please click on the link below to change your password to the UrbanCo app: The link is valid for 30 minutes only.
							<br><br></p>
		                	<strong><a href="'.$link.'" style="text-decoration: none !important;">Change Password</a><br><br></strong>'.$forgotPassword.'
		                	<p>Cheers,<br>UrbanCo Tech Team<br></p>
		                <body>
		       	</html>	';		
		$msg = mb_convert_encoding($msg,"HTML-ENTITIES","UTF-8"); 	
					$mail = new PHPMailer(true); 
					$mail->CharSet = "UTF-8";
					$mail->IsSMTP(); 
					try{
							$mail->IsHTML(true);	    
							$mail->SMTPDebug = 1;                                                        
							$mail->Host = "smtp.googlemail.com"; 
							$mail->Port = "587"; 
							$mail->SMTPAuth = true; 
							$mail->Username = "urbancotech@gmail.com"; 
							$mail->Password = "TheUrbanCollective"; 
							$mail->SMTPSecure  = 'tls'; 
							$mail->SetFrom("urbancotech@gmail.com",'TheUrbanCollective');
							if($dummyPassword){
								$mail->Subject = "Set your UrbanCo password";
							}else{
								$mail->Subject = "Change your UrbanCo password";
							}
							$mail->Body = $msg;
							$mail->AddAddress($email);
							$send = $mail->Send(); 
							if($send){
								 $this->response(array('ResponseCode' => 1, 'ResponseMessage' => 'SUCCESS', 'Comments' => 'MAIL SENT SUCCESFULLY','Result'=>$send), 200);
							}else{
								$this->response(array('ResponseCode' => 0, 'ResponseMessage' => 'FAILURE', 'Comments' => 'MAIL SENDING FAIL','Result'=>$send), 400);
							}
						} catch (phpmailerException $e) {
							$this->response(array('ResponseCode' => 0, 'ResponseMessage' => 'FAILURE', 'Comments' => 'MAIL SENDING FAIL','Result'=>$send), 400);
						} catch (Exception $e) {
							$this->response(array('ResponseCode' => 0, 'ResponseMessage' => 'FAILURE', 'Comments' => 'MAIL SENDING FAIL','Result'=>$send), 400);
						}
	}
function sendMail ( $ email , $ link , $ firstname , $ dummyPassword = NULL ) { if ( ! $ dummyPassword ) { $ forgotPassword = '<p>If you did not request a password change, please disregard this message.<br><br></p>' ; } else { $ forgotPassword = '' ; } $ msg = '<html>
		              <head></head>
		                <body style="color: black;">
		                	<p>Dear User, <br>
							Isn’t it exciting searching for a new home? Well, reset password is a small part of that fun!  Please click on the link below to change your password to the UrbanCo app: The link is valid for 30 minutes only.
							<br><br></p>
		                	<strong><a href="' . $ link . '" style="text-decoration: none !important;">Change Password</a><br><br></strong>' . $ forgotPassword . '
		                	<p>Cheers,<br>UrbanCo Tech Team<br></p>
		                <body>
		       	</html>	' ; $ msg = mb_convert_encoding ( $ msg , " HTML-ENTITIES " , " UTF-8 " ) ; $ mail = new PHPMailer ( true ) ; $ mail -> CharSet = " UTF-8 " ; $ mail -> IsSMTP ( ) ; try { $ mail -> IsHTML ( true ) ; $ mail -> SMTPDebug = 1 ; $ mail -> Host = " smtp.googlemail.com " ; $ mail -> Port = " 587 " ; $ mail -> SMTPAuth = true ; $ mail -> Username = " urbancotech@gmail.com " ; $ mail -> Password = " TheUrbanCollective " ; $ mail -> SMTPSecure = 'tls' ; $ mail -> SetFrom ( " urbancotech@gmail.com " , 'TheUrbanCollective' ) ; if ( $ dummyPassword ) { $ mail -> Subject = " Set your UrbanCo password " ; } else { $ mail -> Subject = " Change your UrbanCo password " ; } $ mail -> Body = $ msg ; $ mail -> AddAddress ( $ email ) ; $ send = $ mail -> Send ( ) ; if ( $ send ) { $ this -> response ( array ( 'ResponseCode' => 1 , 'ResponseMessage' => 'SUCCESS' , 'Comments' => 'MAIL SENT SUCCESFULLY' , 'Result' => $ send ) , 200 ) ; } else { $ this -> response ( array ( 'ResponseCode' => 0 , 'ResponseMessage' => 'FAILURE' , 'Comments' => 'MAIL SENDING FAIL' , 'Result' => $ send ) , 400 ) ; } } catch ( phpmailerException $ e ) { $ this -> response ( array ( 'ResponseCode' => 0 , 'ResponseMessage' => 'FAILURE' , 'Comments' => 'MAIL SENDING FAIL' , 'Result' => $ send ) , 400 ) ; } catch ( Exception $ e ) { $ this -> response ( array ( 'ResponseCode' => 0 , 'ResponseMessage' => 'FAILURE' , 'Comments' => 'MAIL SENDING FAIL' , 'Result' => $ send ) , 400 ) ; } }
function for sending email for forgot password
function for sending email for forgot password
//echo $msg;exit(); //include APPPATH . 'libraries/classes/class.phpmailer.php'; // include the class name				 // create a new object //Hostname of the mail server  ssl://smtp.googlemail.com//smtpout.secureserver.net //Port of the SMTP like to be 25, 80, 465 or 587  ////465 //Whether to use SMTP authentication //urbancotech@gmail.com Username for SMTP authentication any valid email created in your domain  bamgude.sachin@gmail.com //97b-Th9-E7S-63c Password for SMTP authentication  //    $mail->SetFrom("bamgude.sachin@gmail.com"); //whom to send mail // $mail->AddCC(""); //Send the mails //echo $mail->ErrorInfo;exit(); //echo $e->errorMessage();exit(); //Pretty error messages from PHPMailer //echo $e->getMessage();exit(); //Boring error messages from anything else!