Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.
Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin. Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

SMTP orqali aktivlashtirsh xabarlarini yuborishda xatolik?

+2 ovoz
163 marta ko‘rilgan
so‘radi 25 aprel, 17 GENIUS (639 bal)
tahrirlandi 25 aprel, 17 GENIUS

Bitta scriptda SMTP formani sozlay olmayapman. Aniqrog'i xatolik ham yo'q qayerdadir xato bo'lganini ko'rmoqchi bo'lsam.  Kodlarni kiritgacha forma faqat loading bo'lib turubdi xalos. Sabab nimadaligini tushunmayapman. Forma ro'yxatdan o'tish va activatsiya kodlarini yuborish uchun ishlatishga kerak.

Boshlang'ich orginal holatdagi kodi quyidagicha.

<?php
require_once(dirname(__FILE__).'/../../config.php');

$t	=	$prepare->sanitize($_GET['t'],'input');

if ( $t	==	'new' ){
	//** users **//
	$user_email		=	$prepare->sanitize($_POST['email'],'input');
	$u_password		=	$prepare->sanitize($_POST['password'],'input');
	$user_password	=	md5($u_password);
	$user_status	=	md5($user_password.strtotime("now").rand().rand());

		$validate 			= $db->Query("SELECT `user_email` FROM users where user_email=?","s",$user_email);
		$validatePending 	= $db->Query("SELECT `user_email` FROM junk_users where user_email=?","s",$user_email);


	if ( empty ( $validate ) && empty ( $validatePending ) ) {
		$insert = $db->NoQuery("INSERT INTO junk_users VALUES(NULL,?,?,?)","sss",$user_email,$user_password,$user_status);
		if ( $insert ) {
			$user_id	=	$db->LastID();
		
			//** users_address **//
			$ua_user_id		=	$user_id;
			$ua_country		=	$prepare->sanitize($_POST['location'],'input');
			$ua_state		=	'';
			$ua_city		=	'';
			$ua_zip			=	'';
			$ua_address		=	'';
			$db->NoQuery("INSERT INTO junk_users_address VALUES(?,?,?,?,?,?)","isssss",$ua_user_id,$ua_country,$ua_state,$ua_city,$ua_zip,$ua_address);
		
			//** users_profiles **//
			$up_user_id		=	$user_id;
			$up_first_name	=	$prepare->sanitize($_POST['fname'],'input');
			$up_last_name	=	$prepare->sanitize($_POST['lname'],'input');
			
			$month			=	$prepare->sanitize($_POST['month'],'input');
			$day			=	$prepare->sanitize($_POST['day'],'input');
			$year			=	$prepare->sanitize($_POST['year'],'input');
			
			$up_birthday	=	strtotime(date('Y-m-d', strtotime($year.'-'.$month.'-'.$day)));
			$up_phone		=	'';
			$up_tax_id		=	'';

			$db->NoQuery("INSERT INTO junk_users_profiles VALUES(?,?,?,?,?,?)","ssssss",$up_user_id,$up_first_name,$up_last_name,$up_birthday,$up_phone,$up_tax_id);

	/********************* start submiting email *********************/
$details =$LANG["WBS_REGM_1"]."
".$LANG["WBS_REGM_8"];
	$fromEmail = NO_REPLY;
	$headers = "MIME-Version: 1.0" . "\r\n";
	$headers .= "Content-Type: text/plain; charset=utf-8" . "\r\n";
	$headers .= "From: ".$fromEmail. "\r\n";
	$subject = $LANG["WBS_REGM_SUBJECT"];
	mail($user_email,$subject,$details,$headers);
	/********************* end submiting email *********************/

	echo '<div id="mode">1</div>';


		} else {
				echo '<div id="mode">2</div>';
		}
	} else {
				echo '<div id="mode">3</div>';
	}


}
//Huddi shu holatda yana uchta forma yangi kod yuborish va yangi parolni yuborish uchun forma mavjud

Man qilgan holat quyidagicha:

<?php
require_once(dirname(__FILE__).'/../../config.php');
require(dirname(__FILE__).'PHPMailerAutoload.php'); 

$t	=	$prepare->sanitize($_GET['t'],'input');

if ( $t	==	'new' ){
	//** users **//
	$user_email		=	$prepare->sanitize($_POST['email'],'input');
	$u_password		=	$prepare->sanitize($_POST['password'],'input');
	$user_password	=	md5($u_password);
	$user_status	=	md5($user_password.strtotime("now").rand().rand());

		$validate 			= $db->Query("SELECT `user_email` FROM users where user_email=?","s",$user_email);
		$validatePending 	= $db->Query("SELECT `user_email` FROM junk_users where user_email=?","s",$user_email);


	if ( empty ( $validate ) && empty ( $validatePending ) ) {
		$insert = $db->NoQuery("INSERT INTO junk_users VALUES(NULL,?,?,?)","sss",$user_email,$user_password,$user_status);
		if ( $insert ) {
			$user_id	=	$db->LastID();
		
			//** users_address **//
			$ua_user_id		=	$user_id;
			$ua_country		=	$prepare->sanitize($_POST['location'],'input');
			$ua_state		=	'';
			$ua_city		=	'';
			$ua_zip			=	'';
			$ua_address		=	'';
			$db->NoQuery("INSERT INTO junk_users_address VALUES(?,?,?,?,?,?)","isssss",$ua_user_id,$ua_country,$ua_state,$ua_city,$ua_zip,$ua_address);
		
			//** users_profiles **//
			$up_user_id		=	$user_id;
			$up_first_name	=	$prepare->sanitize($_POST['fname'],'input');
			$up_last_name	=	$prepare->sanitize($_POST['lname'],'input');
			
			$month			=	$prepare->sanitize($_POST['month'],'input');
			$day			=	$prepare->sanitize($_POST['day'],'input');
			$year			=	$prepare->sanitize($_POST['year'],'input');
			
			$up_birthday	=	strtotime(date('Y-m-d', strtotime($year.'-'.$month.'-'.$day)));
			$up_phone		=	'';
			$up_tax_id		=	'';

			$db->NoQuery("INSERT INTO junk_users_profiles VALUES(?,?,?,?,?,?)","ssssss",$up_user_id,$up_first_name,$up_last_name,$up_birthday,$up_phone,$up_tax_id);

	/********************* start submiting email *********************/
$details =$LANG["WBS_REGM_1"]."
".$LANG["WBS_REGM_8"];
	$mail = new PHPMailer();
	$mail->IsSMTP();
	$mail->Mailer = "smtp";
	$mail->Host = "mail.smtp2go.com";
	$mail->Port = "465"; 
	$mail->SMTPAuth = true;
	$mail->SMTPSecure = 'tls';
	$mail->Username = "smtp_username";
	$mail->Password = "smtp_password";
	
	$mail->$fromEmail = NO_REPLY;
	$mail->$headers = "MIME-Version: 1.0" . "\r\n";
	$mail->$headers .= "Content-Type: text/plain; charset=utf-8" . "\r\n";
	$mail->$headers .= "From: ".$fromEmail. "\r\n";
	$mail->$subject = $LANG["WBS_REGM_SUBJECT"];
	$mail->mail($user_email,$subject,$details,$headers);
	/********************* end submiting email *********************/
	if(!$mail->Send()) {
		echo 'Message was not sent.';
			echo 'Mailer error: ' . $mail->ErrorInfo;
			exit;
	} else {
		echo 'Message has been sent.';
	}

	echo '<div id="mode">1</div>';


		} else {
				echo '<div id="mode">2</div>';
		}
	} else {
				echo '<div id="mode">3</div>';
	}


}

Bu yerda xatolik ham bermayapdi. Buni qayerida xato kiritmoqdaman? Yoki kamchiligi bor?

1 ta javob

+2 ovoz
javob berdi 26 aprel, 17 SedBigDaddy (1,237 bal)

Eng Yaxshisi Google SMTPdan foydalaning. Uning uchun Gmailda ro'yhatdan oting, so'ng username password ni olib uni ishlatin yani:

$mail = new PHPMailer();
	$mail->IsSMTP();
	$mail->Mailer = "smtp";
	$mail->Host = "smtp.gmail.com";
	$mail->Port = "587"; 
	$mail->SMTPAuth = true;
	$mail->SMTPSecure = 'tls';
	$mail->Username = "sizningEmail@gmail.com";
	$mail->Password = "sizningParolingiz";
izoh qoldirdi 26 aprel, 17 GENIUS (639 bal)
Bularni ham qilib ko'rdim, Ammo natija chiqmayapdi. Man aynan nimaga murojat qvotganida adashyapmanmi deyman. Foydalanuvchi ro'yxatdan o'tgach activlashtirsh kodi yuborilishi uchun yozilgan bu class. Ammo oddiy mail() funksiyada ishlavotti. SMTP qo'shilgacha faqat loading bo'lib turubdi xatolik ham yo'q. Bizdagi hostinglarda oddiy mail() funksiya ishlamaydida...

Assalomu alaykum, yordam.uz saytimizga xush kelibsiz.

Bu saytda o`zingizni qiziqtirgan savollarga javob olishingiz va o`z sohangiz bo`yicha savollarga javob berishingiz mumkin.

Bizning Oilamizga a'zo bo`lganingiz uchun chuqur Minnatdorchilik bildiramiz !!!

Telegram kanal YordamUzRss

...