im using a TinyMCE plugin for yii2 by 2amigos.
I need all the content entered within the editor to be sent by email.
It does a great job with background, heading color text as far I have tested.
But with pictures it shows the tag as shown below:
While in the editor it looks good:
My view:
<?php
/* @var $this yii\web\View */
$this->title = 'My Yii Application';
use dosamigos\tinymce\TinyMce;
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use app\models\SendEmailForm;
$model = new SendEmailForm;
?>
<div class="site-index">
<div class="body-content">
<div class="row">
<?php
$form = ActiveForm::begin([
'id' => 'sendemail-form',
'options' => ['class' => ''],
'action' => 'site/enviarcorreo'
])
?>
<?= $form->field($model, 'correo') ?>
<?= $form->field($model, 'contenido')->widget(TinyMce::className(), [
'options' => ['rows' => 30],
'language' => 'es',
'clientOptions' => [
'plugins' => [
"print preview powerpaste casechange importcss tinydrive searchreplace autolink autosave directionality advcode visualblocks visualchars fullscreen image link media mediaembed template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists checklist wordcount tinymcespellchecker a11ychecker imagetools textpattern noneditable help formatpainter permanentpen pageembed charmap quickbars linkchecker emoticons advtable"
],
'toolbar' => "undo redo | bold italic underline strikethrough | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist checklist | forecolor backcolor casechange permanentpen formatpainter removeformat | pagebreak | charmap emoticons | fullscreen preview print | insertfile image media pageembed template link anchor codesample | a11ycheck ltr rtl",
'menubar' => false,
'convert_urls' => false,
'file_picker_types' => 'image',
]
]);?>
<div class="form-group">
<?= Html::submitButton('Enviar', ['class' => 'btn btn-primary']) ?>
</div>
<?php ActiveForm::end() ?>
</div>
</div>
</div>
Controller action:
public function actionEnviarcorreo()
{
$model = new \app\models\SendEmailForm;
if ($model->load(Yii::$app->request->post()) && $model->validate())
{
Yii::$app->mailer->compose()
->setFrom('darknightedm@gmail.com')
->setTo($model->correo)
->setSubject('Email enviado desde Yii2-Swiftmailer')
->setHtmlBody($model->contenido)
->send();
}
}
What can I do to make this possible?. Thanks for read.