public function insertForm()
{
$Form= new Form();
$Form->name = $this->name;
$Form->email = $this->email;
$Form->age = $this->age;
$Form->height= $this->height;
$Form->weight= $this->weight;
$Form->city = $this->city;
$Form->techies = $this->techies;
$Form->english_level = $this->english_level;
$Form->images = UploadedFile::getInstances($Form,'images');
foreach($Form->images as $file){
$folder = ('uploads/' . $file->baseName . '.' . $file->extension);
$file->saveAs('uploads/' . $file->baseName . '.' . $file->extension);
$Form->image_1.=$folder . ';';
}
return $Form->save(false);
}
public function contact($email)
{
$Form = new Form();
if ($this->validate()) {
Yii::$app->mailer->compose()
->setTo($this->email)
->setFrom('ppbesta@mail.ru')
->setSubject('Hello')
->setTextBody('Hello')
->send();
return true;
} else {
return false;
}
}
'mail' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@backend/mail',
'useFileTransport' => false,//set this property to false to send mails to real email addresses
//comment the following array to send mail using php's mail function
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp.gmail.com',
'username' => 'username@gmail.com',
'password' => 'password',
'port' => '587',
'encryption' => 'tls',
],
],
],