Skip to content

Commit

Permalink
Added configuring how email will be sent from mautic to the installer…
Browse files Browse the repository at this point in the history
… and updated UI some
  • Loading branch information
Alan Hartless authored and Alan Hartless committed Nov 28, 2014
1 parent 4e6286a commit dd14504
Show file tree
Hide file tree
Showing 26 changed files with 984 additions and 252 deletions.
1 change: 1 addition & 0 deletions app/bundles/ConfigBundle/Form/Type/ConfigType.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'mautic.transport.mandrill' => 'mautic.core.config.mailer_transport.mandrill',
'mautic.transport.sendgrid' => 'mautic.core.config.mailer_transport.sendgrid',
'mautic.transport.amazon' => 'mautic.core.config.mailer_transport.amazon',
'mautic.transport.postmark' => 'mautic.core.config.mailer_transport.postmark',
'gmail' => 'mautic.core.config.mailer_transport.gmail',
'sendmail' => 'mautic.core.config.mailer_transport.sendmail',
'smtp' => 'mautic.core.config.mailer_transport.smtp'
Expand Down
1 change: 1 addition & 0 deletions app/bundles/CoreBundle/Config/parameters.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'mailer_from_email' => '[email protected]',
'mailer_transport' => 'mail',
'mailer_host' => '',
'mailer_port' => null,
'mailer_user' => null,
'mailer_password' => null,
'mailer_encryption' => null, //tls or ssl,
Expand Down
6 changes: 6 additions & 0 deletions app/bundles/CoreBundle/Config/services/mailers.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,10 @@
new Definition (
'Mautic\CoreBundle\Swiftmailer\Transport\SendgridTransport'
)
);

$container->setDefinition('mautic.transport.postmark',
new Definition (
'Mautic\CoreBundle\Swiftmailer\Transport\PostmarkTransport'
)
);
24 changes: 24 additions & 0 deletions app/bundles/CoreBundle/Swiftmailer/Transport/PostmarkTransport.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
/**
* @package Mautic
* @copyright 2014 Mautic Contributors. All rights reserved.
* @author Mautic
* @link http://mautic.org
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/

namespace Mautic\CoreBundle\Swiftmailer\Transport;

/**
* Class PostmarkTransport
*/
class PostmarkTransport extends \Swift_SmtpTransport
{
/**
* {@inheritdoc}
*/
public function __construct($host = 'localhost', $port = 25, $security = null)
{
parent::__construct('smtp.postmarkapp.com', 587, 'tls');
}
}
2 changes: 2 additions & 0 deletions app/bundles/CoreBundle/Translations/en_US/messages.ini
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ mautic.core.config.mailer_transport.gmail="Gmail"
mautic.core.config.mailer_transport.mail="PHP Mail"
mautic.core.config.mailer_transport.sendmail="Sendmail"
mautic.core.config.mailer_transport.smtp="Other SMTP Server"
mautic.core.config.mailer_transport.postmark="Postmark"

mautic.core.config.mailer_encryption.ssl="SSL"
mautic.core.config.mailer_encryption.tls="TLS"
Expand All @@ -193,6 +194,7 @@ mautic.config.CoreBundle.mailer_from_name="Name to Send Mail As"
mautic.config.CoreBundle.mailer_from_email="E-mail Address to Send Mail From"
mautic.config.CoreBundle.mailer_transport="Mail Transport"
mautic.config.CoreBundle.mailer_host="Host to Send Mail From"
mautic.config.CoreBundle.mailer_port="SMTP Port"
mautic.config.CoreBundle.mailer_user="Username for Account Mail is Sent From"
mautic.config.CoreBundle.mailer_password="Password for Account Mail is Sent From"
mautic.config.CoreBundle.mailer_encryption="Encryption Type for Mail"
Expand Down
11 changes: 6 additions & 5 deletions app/bundles/InstallBundle/Configurator/Form/CheckStepType.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'label' => 'mautic.install.next.step',
'type' => 'submit',
'attr' => array(
'class' => 'btn btn-success pull-right mt-20',
'icon' => 'fa fa-arrow-circle-right'
'class' => 'btn btn-success pull-right btn-next',
'icon' => 'fa fa-arrow-circle-right',
'onclick' => 'MauticInstaller.showWaitMessage(event);'
)
)
),
'apply_text' => '',
'save_text' => '',
'cancel_text' => ''
'apply_text' => '',
'save_text' => '',
'cancel_text' => ''
));

if (!empty($options['action'])) {
Expand Down
29 changes: 18 additions & 11 deletions app/bundles/InstallBundle/Configurator/Form/DoctrineStepType.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function buildForm (FormBuilderInterface $builder, array $options)
'choices' => DoctrineStep::getDrivers(),
'expanded' => false,
'multiple' => false,
'label' => 'mautic.install.install.form.database.driver',
'label' => 'mautic.install.form.database.driver',
'label_attr' => array('class' => 'control-label'),
'empty_value' => false,
'required' => true,
Expand All @@ -41,42 +41,42 @@ public function buildForm (FormBuilderInterface $builder, array $options)
));

$builder->add('host', 'text', array(
'label' => 'mautic.install.install.form.database.host',
'label' => 'mautic.install.form.database.host',
'label_attr' => array('class' => 'control-label'),
'attr' => array('class' => 'form-control'),
'required' => true
));

$builder->add('port', 'text', array(
'label' => 'mautic.install.install.form.database.port',
'label' => 'mautic.install.form.database.port',
'label_attr' => array('class' => 'control-label'),
'attr' => array('class' => 'form-control'),
'required' => false
));

$builder->add('name', 'text', array(
'label' => 'mautic.install.install.form.database.name',
'label' => 'mautic.install.form.database.name',
'label_attr' => array('class' => 'control-label'),
'attr' => array('class' => 'form-control'),
'required' => true
));

$builder->add('table_prefix', 'text', array(
'label' => 'mautic.install.install.form.database.table.prefix',
'label' => 'mautic.install.form.database.table.prefix',
'label_attr' => array('class' => 'control-label'),
'attr' => array('class' => 'form-control'),
'required' => false
));

$builder->add('user', 'text', array(
'label' => 'mautic.install.install.form.database.user',
'label' => 'mautic.install.form.database.user',
'label_attr' => array('class' => 'control-label'),
'attr' => array('class' => 'form-control'),
'required' => true
));

$builder->add('password', 'password', array(
'label' => 'mautic.install.install.form.database.password',
'label' => 'mautic.install.form.database.password',
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control',
Expand All @@ -92,13 +92,19 @@ public function buildForm (FormBuilderInterface $builder, array $options)
),
'label' => 'mautic.install.form.existing_tables',
'expanded' => true,
'empty_value' => false
'empty_value' => false,
'attr' => array(
'tooltip' => 'mautic.install.form.existing_tables_descr',
'onchange' => 'MauticInstaller.toggleBackupPrefix();'
)
));

$builder->add('backup_prefix', 'text', array(
'label' => 'mautic.install.form.backup_prefix',
'label_attr' => array('class' => 'control-label'),
'attr' => array('class' => 'form-control'),
'attr' => array(
'class' => 'form-control'
),
'required' => false
));

Expand All @@ -109,8 +115,9 @@ public function buildForm (FormBuilderInterface $builder, array $options)
'label' => 'mautic.install.next.step',
'type' => 'submit',
'attr' => array(
'class' => 'btn btn-success pull-right mt-20',
'icon' => 'fa fa-arrow-circle-right'
'class' => 'btn btn-success pull-right btn-next',
'icon' => 'fa fa-arrow-circle-right',
'onclick' => 'MauticInstaller.showWaitMessage(event);'
)
)
),
Expand Down
189 changes: 189 additions & 0 deletions app/bundles/InstallBundle/Configurator/Form/EmailStepType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?php
/**
* @package Mautic
* @copyright 2014 Mautic Contributors. All rights reserved.
* @author Mautic
* @link http://mautic.org
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/

namespace Mautic\InstallBundle\Configurator\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
use Symfony\Component\Form\FormBuilderInterface;

/**
* Email Form Type.
*/
class EmailStepType extends AbstractType
{
/**
* {@inheritdoc}
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('mailer_from_name', 'text', array(
'label' => false,
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control',
'placeholder' => 'mautic.install.form.email.from_name'
),
'required' => true
));

$builder->add('mailer_from_email', 'email', array(
'label' => false,
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control',
'preaddon' => 'fa fa-envelope',
'placeholder' => 'mautic.install.form.email.from_address',
),
'required' => true
));

$builder->add('mailer_transport', 'choice', array(
'choices' => array(
'mail' => 'mautic.core.config.mailer_transport.mail',
'mautic.transport.mandrill' => 'mautic.core.config.mailer_transport.mandrill',
'mautic.transport.sendgrid' => 'mautic.core.config.mailer_transport.sendgrid',
'mautic.transport.amazon' => 'mautic.core.config.mailer_transport.amazon',
'mautic.transport.postmark' => 'mautic.core.config.mailer_transport.postmark',
'gmail' => 'mautic.core.config.mailer_transport.gmail',
'smtp' => 'mautic.core.config.mailer_transport.smtp',
'sendmail' => 'mautic.core.config.mailer_transport.sendmail'
),
'label' => 'mautic.install.form.email.transport',
'label_attr' => array('class' => 'control-label'),
'empty_value' => false,
'attr' => array(
'class' => 'form-control',
'tooltip' => 'mautic.install.form.email.transport_descr',
'onchange' => 'MauticInstaller.toggleTransportDetails(this.value);'
)
));

$builder->add('mailer_host', 'text', array(
'label' => 'mautic.install.form.email.mailer_host',
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control'
)
));

$builder->add('mailer_port', 'text', array(
'label' => 'mautic.install.form.email.mailer_port',
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control'
)
));

$builder->add('mailer_user', 'text', array(
'label' => 'mautic.install.form.email.mailer_user',
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control'
)
));

$builder->add('mailer_password', 'password', array(
'label' => 'mautic.install.form.email.mailer_password',
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control',
'preaddon' => 'fa fa-lock'
)
));

$builder->add('mailer_encryption', 'button_group', array(
'choice_list' => new ChoiceList(
array('tls', 'ssl'),
array('mautic.install.form.email.encryption_tls', 'mautic.install.form.email.encryption_ssl')
),
'label' => 'mautic.install.form.email.encryption',
'expanded' => true,
'empty_value' => 'mautic.install.form.none'
));

$builder->add('mailer_auth_mode', 'choice', array(
'choice_list' => new ChoiceList(
array(
'plain',
'login',
'cram-md5'
),
array(
'mautic.install.form.email.auth_mode_plain',
'mautic.install.form.email.auth_mode_login',
'mautic.install.form.email.auth_mode_cram-md5'
)
),
'label' => 'mautic.install.form.email.auth_mode',
'label_attr' => array('class' => 'control-label'),
'empty_value' => 'mautic.install.form.none',
'attr' => array(
'class' => 'form-control',
'onchange' => 'MauticInstaller.toggleAuthDetails(this.value);'
)
));

$builder->add('mailer_spool_type', 'button_group', array(
'choice_list' => new ChoiceList(
array('memory', 'file'),
array(
'mautic.install.form.email.spool_memory',
'mautic.install.form.email.spool_file'
)
),
'label' => 'mautic.install.form.email.spool_type',
'expanded' => true,
'empty_value' => false,
'attr' => array(
'onchange' => 'MauticInstaller.toggleSpoolQueue();'
)
));

$builder->add('mailer_spool_path', 'text', array(
'label' => 'mautic.install.form.email.spool_path',
'label_attr' => array('class' => 'control-label'),
'attr' => array(
'class' => 'form-control',
'tooltip' => 'mautic.install.form.email.spool_path_descr'
)
));

$builder->add('buttons', 'form_buttons', array(
'pre_extra_buttons' => array(
array(
'name' => 'next',
'label' => 'mautic.install.next.step',
'type' => 'submit',
'attr' => array(
'class' => 'btn btn-success pull-right btn-next',
'icon' => 'fa fa-arrow-circle-right',
'onclick' => 'MauticInstaller.showWaitMessage(event);'
)
)
),
'apply_text' => '',
'save_text' => '',
'cancel_text' => ''
));


if (!empty($options['action'])) {
$builder->setAction($options['action']);
}
}

/**
* {@inheritdoc}
*/
public function getName()
{
return 'install_email_step';
}
}
Loading

0 comments on commit dd14504

Please sign in to comment.