ich benutze Yii2, die mit uns in Verbindung treten, bilden Sie. aber nicht in der Lage E-Mail von Benutzern zu erhalten, die in E-Mail-Bereich Kontaktformular gefüllt ist ..wie man email Feld des Kontaktes uns Form in der eMail erhält, die admin bekam (yii2)
public function sendEmail($email)
{
return Yii::$app->mailer->compose()
->setTo($email)
->setFrom([$this->email => $this->name])
//echo "emailll<pre>";print_r($this->email);exit;
//here I am getting the correct email which is filled in contact form
//but when I received mail. nowhere I got That email id...
// In from: [email protected] which i set as username
// In To : [email protected] which i set as admin email id
->setSubject($this->subject)
->setTextBody($this->body)
->send();
}
, wie die E-Mail zu bekommen?
hier ansehen/contact.php
<?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
<?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>
<?= $form->field($model, 'email') ?> **<--I want this email id to be printed on received mail-->**
<?= $form->field($model, 'subject') ?>
<?= $form->field($model, 'body')->textarea(['rows' => 2])//->label('Message') ?>
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-5">{image}</div><div class="col-lg-5">{input}</div></div>',
]) ?>
<div class="form-group">
<?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
</div>
<?php ActiveForm::end(); ?>
Es ist nicht ganz klar, was ist dein Problem. Wenn Sie den $ email-Befehl nicht erhalten können, sollten Sie hier Ihren Ansichtscode des Kontaktformulars und die Methode, die sendEmail-Methode ausführt, posten. –
Ich habe die Frage von Addin-View-Code darin aktualisiert .. –