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

Send mail from vokuro contact form

Hi,

i am using vokuro for my project and i have created a custom contact form, so far so good.

Now i want to send the contact informations to my mailserver and i have no idea how to do that.

Is it mandatory to have the amazon key pair? Or do i have to insert only the smtp, port, user and password for mail? Do i have to insert any data somewhere else?

In Firebug network i get no errors after sending.

This is the config.php:

<?php
return new \Phalcon\Config(array(
'database' => array(
    'adapter' => 'Mysql',
    'host' => '127.0.0.1',
    'username' => 'root',
    'password' => '',
    'dbname' => 'vokuro'
),
'application' => array(
    'controllersDir' => APP_DIR . '/controllers/',
    'modelsDir' => APP_DIR . '/models/',
    'formsDir' => APP_DIR . '/forms/',
    'viewsDir' => APP_DIR . '/views/',
    'libraryDir' => APP_DIR . '/library/',
    'pluginsDir' => APP_DIR . '/plugins/',
    'cacheDir' => APP_DIR . '/cache/',
    'baseUri' => '/vokuro/',
    'publicUrl' => 'vokuro.phalcon.io',
    'cryptSalt' => 'eEAfR|_&G&f,+vU]:jFr!!A&+71w1Ms9~8_4L!<@[[email protected]_2My|:+.u>/6m,$D'
),
'mail' => array(
    'fromName' => 'Vokuro',
    'fromEmail' => '[email protected]',
    'smtp' => array(
        'server' => 'smtp.gmail.com',
        'port' => 587,
        'security' => 'tls',
        'username' => '',
        'password' => ''
    )
),
'amazon' => array(
    'AWSAccessKeyId' => '',
    'AWSSecretKey' => ''
)
));

Thank you for help

Stefan



11.6k

if you want to use the default php mailo func., you have to setup Postfix (the default mail server on debian distro) or any mail server you have

for postfix, edit your php.ini and check sendmail_path is set :

    sendmail_path = /usr/sbin/sendmail -t -i

edit your sasl_passwd file and add it your mail connection id: (ex using smtp of google):

    [smpt.gmail.com]:587 [email protected]:your password

add the password/login to the postfix db, run:


    postmap /etc/postfix/sasl_passwd

you should be ready, don't forget to open port in firewall



60.0k

Hello graphmatic,

thank you for your quick response, but how does it work on my own server, with different websites and different mailserver/addresse?

Do i just have to add it in the php.ini?

Rgds

Stefan



11.6k

it's difficult to help you without knowing what is your system, but basically, if you use postfix, just follow this setup instructions, the address setup in postfix db is just used as a relay if you want to use foreign smtp server (and avoid to be filtered by spam filters). After that, you can override the sender adress in your php mail function (the 'from' param), so you can handle multiple website on same server.