@Ghuraba

PHP yii1119 почему почта в gmail'e уходит в спам, а c остальными все ок?

Доброго вечера, всем!
Друзья программисты, cтолкнулся с такой проблемой в gmail'e, что вся почта уходит в спам, с яндексом проверял, все норм, а вот с gmail'ом проблемы, что при регистрации, что при восстановлении пароля, а уже не говоря про все остальное, все уходит в спам... код на php yii1119
кто знает как с этим справиться окажите помощь, пожалуйста, а то уже голова кругом идет... 2-3 день ищу проблему?

1.../*Регистрация*/
public function actionRegistration()
	{
		$this->breadcrumbs=array('Регистрация');
		$form = new RegistrationForm;
		$form->scenario = 'mainRegistration';

		$this->performAjaxValidation($form);

		if (!Yii::app()->user->isGuest)
		{
			$this->render("registration", array(
					'model' => $form,
					'Guest' => true
				)
			);
			Yii::app()->end();
		} else {
			if (!empty($_POST['RegistrationForm']))
			{
				$form->attributes = $_POST['RegistrationForm'];

				if($_POST['RegistrationForm']['phone'])
				{
					$this->redirect('/');
				}

				if($form->validate())
				{
					$user = new User;
					$user->attributes = $form->attributes;
					$user->role = 'user';

					$this->sendMail("web-tech@yandex.ru","Регистрация на сайте test.RU","Ваш пароль для доступа в личный кабинет: $user->password");

					if($user->save()) {
						Yii::app()->user->setFlash('success','Вы зарегистрированы! Можете зайти под своим логин-паролем');
						$this->redirect(array('site/index'));
					}
				} else {
					$this->render("registration", array('model' => $form));
					Yii::app()->end();
				}
			} else {
				$this->render("registration", array('model' => $form));
				Yii::app()->end();
			}
		}
		$this->render("registration", array('model' => $form));
	}


2...
public function sendMail($to,$subject,$message)
	{
		$mailer = Yii::app()->mail;
		$mailer->From = "info@.......ru";


		$mailer->AddAddress($to);
		$mailer->FromName = Yii::app()->name;
		$mailer->CharSet = 'UTF-8';
		$mailer->Subject = $subject;
		$mailer->Body = $message;
		$mailer->isHtml(1);
		$mailer->Send();
	}


3...
public function Send() {
    try {
      if ((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
        throw new phpmailerException($this->Lang('provide_address'), self::STOP_CRITICAL);
      }

      // Set whether the message is multipart/alternative
      if(!empty($this->AltBody)) {
        $this->ContentType = 'multipart/alternative';
      }

      $this->error_count = 0; // reset errors
      $this->SetMessageType();
      $header = $this->CreateHeader();
      $body = $this->CreateBody();

      if (empty($this->Body)) {
        throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
      }

      // Choose the mailer and send through it
      switch($this->Mailer) {
        case 'sendmail':
          return $this->SendmailSend($header, $body);
        case 'smtp':
          return $this->SmtpSend($header, $body);
        case 'mail':
        default:
          return $this->MailSend($header, $body);
      }

    } catch (phpmailerException $e) {
      $this->SetError($e->getMessage());
      if ($this->exceptions) {
        throw $e;
      }
      echo $e->getMessage()."\n";
      return false;
    }
  }
  • Вопрос задан
  • 138 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы