mremi / ContactBundle

Provides a contact form for a Symfony project.
27 stars 23 forks source link

Email message #32

Closed fcpauldiaz closed 9 years ago

fcpauldiaz commented 9 years ago

I'm able to send emails but the message content is always: mremi_contact.email_message_html

I overrode the bundle, maybe I missed something. I didn't knew how to remove the title so I just hided it.

config.yml

mremi_contact:
    store_data:            false

    form:
        type:              contact_type
        name:              contact
        validation_groups: [Default]
        subject_provider:  mremi_contact.subject_provider.noop

    email:
        mailer:            mremi_contact.mailer.twig_swift
        from:              []
        to:                
           - { address: dia13203@uvg.edu.gt, name: "Admin" } # Required
        template:          MremiContactBundle:Contact:email.txt.twig

services.yml


    contact.form.registration:
        class: ContactBundle\Form\Type\ContactType
        tags:
            - { name: form.type, alias: contact_type }

ContactType

<?php

namespace ContactBundle\Form\Type;

use Mremi\ContactBundle\Model\Contact;
use Mremi\ContactBundle\Provider\SubjectProviderInterface;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

/**
 * Contact type class
 *
 * @author Rémi Marseille <marseille.remi@gmail.com>
 */
class ContactType extends AbstractType
{

    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('title', 'hidden', array(
                  'data'=> 'mr',
            ))
            ->add('firstName', 'text',  array('label' => 'mremi_contact.form.first_name'))
            ->add('lastName',  'text',  array('label' => 'mremi_contact.form.last_name'))
            ->add('email',     'email', array('label' => 'mremi_contact.form.email'))
            ->add('subject', 'text', array('label' => 'mremi_contact.form.subject'))
            ->add('message', 'textarea', array('label' => 'mremi_contact.form.message'));

        //$builder->add('save', 'submit', array('label' => 'mremi_contact.form_submit'));
    }

    /**
     * {@inheritdoc}
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(

            'intention'          => 'contact',
            'translation_domain' => 'MremiContactBundle',
        ));
    }

    public function getName()
    {
        return 'contact_type';
    }
}
mremi commented 9 years ago

Hi @fcpauldiaz , does your PR #33 fix this issue?

fcpauldiaz commented 9 years ago

Hi, @mremi yes it does

mremi commented 9 years ago

Ok so I close it