We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Please need help for sending mail from vokuro contact form

Hi @all,

I know that i asked this several times, but i tried to fix this problem since 1 week.

Vokuro is my base system and i just want to send data from a simple contact form, nothing more!

I created a amazon account and verified my email address, but maybe i forgot something

This is my contact form view:

{{ content() }}

   <div class="container" style="padding-top: 100px">
<div class="row">
    <div class="col-xs-12">
        <h3 class="divider-new iDividerFontSize">KONTAKT</h3>
    </div>
          {{ form('class': 'col-md-12') }}
        <div class="row">
            <div class="input-field col-md-6">
                <i class="material-icons prefix">account_circle</i>
                {{ form.render('vorname') }}
                {{ form.label('vorname') }}
                {{ form.messages('vorname') }}
            </div>
            <div class="input-field col-md-6">
                <i class="material-icons prefix">phone</i>
                {{ form.render('nachname') }}
                {{ form.label('nachname') }}
                {{ form.messages('nachname') }}
            </div>
        </div>

        <div class="row">
            <div class="input-field col-md-6">
                <i class="material-icons prefix">account_circle</i>
                {{ form.render('email') }}
                {{ form.label('email') }}
                {{ form.messages('email') }}
            </div>
            <div class="input-field col-md-6">
                <i class="material-icons prefix">phone</i>
                {{ form.render('telefon') }}
                {{ form.label('telefon') }}
                {{ form.messages('telefon') }}
            </div>
        </div>
        <div class="row">
            <div class="input-field col-md-12">
                <i class="material-icons prefix">phone</i>
                {{ form.render('nachricht') }}
                {{ form.label('nachricht') }}
                {{ form.messages('nachricht') }}
            </div>
        </div>
        <div class="row">
            <div class="col-md-12">
                {{ form.render('Absenden') }}
            </div>
        </div>
        </form>
</div>
</div>

This is my form render:

<?php
namespace Vokuro\Forms;

use Phalcon\Forms\Form;
use Phalcon\Forms\Element\Text;
use Phalcon\Forms\Element\TextArea;
use Phalcon\Forms\Element\Submit;
use Phalcon\Validation\Validator\PresenceOf;
use Phalcon\Validation\Validator\Email;
use Phalcon\Validation\Validator\Identical;
use Phalcon\Validation\Validator\StringLength;
use Phalcon\Validation\Validator\Confirmation;

class KontaktForm extends Form
{

public function initialize($entity = null, $options = null)
{
    $vorname = new Text('vorname');

    $vorname->setLabel('Vorname');

    $vorname->addValidators(array(
        new PresenceOf(array(
            'message' => 'Der Vorname ist Pflicht'
        ))
    ));

    $this->add($vorname);

    $nachname = new Text('nachname');

    $nachname->setLabel('Nachname');

    $nachname->addValidators(array(
        new PresenceOf(array(
            'message' => 'Der Nachname ist Pflicht'
        ))
    ));

    $this->add($nachname);

    // Email
    $email = new Text('email');

    $email->setLabel('E-Mail');

    $email->addValidators(array(
        new PresenceOf(array(
            'message' => 'The e-mail is required'
        )),
        new Email(array(
            'message' => 'The e-mail is not valid'
        ))
    ));

    $this->add($email);

    $telefon = new Text('telefon');

    $telefon->setLabel('Telefon');

    $telefon->addValidators(array(
        new PresenceOf(array(
            'message' => 'Der Nachname ist Pflicht'
        ))
    ));

    $this->add($telefon);

    $nachricht = new TextArea('nachricht',array('class' => 'materialize-textarea'));

    $nachricht->setLabel('Nachricht');

    $nachricht->addValidators(array(
        new PresenceOf(array(
            'message' => 'Der Nachname ist Pflicht'
        ))
    ));

    $this->add($nachricht);

    // Sign Up
    $this->add(new Submit('Absenden', array(
        'class' => 'btn btn-primary btn-xlg pull-right'
    )));
}

/**
 * Prints messages for a specific element
 */
public function messages($name)
{
    if ($this->hasMessagesFor($name)) {
        foreach ($this->getMessagesFor($name) as $message) {
            $this->flash->error($message);
        }
    }
}
}

My config.php

'mail' => array(
    'fromName' => 'MyName',
    'fromEmail' => 'MyStratoEmail',
    'smtp' => array(
        'server' => 'smtp.strato.de',
        'port' => 465,
        'security' => 'tls',
        'username' => 'MyStratoUsername',
        'password' => 'MyStratoPsssword'
    )
),
'amazon' => array(
    'AWSAccessKeyId' => 'Is set',
    'AWSSecretKey' => 'Is set'
)

Thanks in advance

Stefan



11.0k

I guess you don't have form action to post form's data to controller so the data will not send , Can you capture your view source html this form ?