Skip to content

How to configure this bundle in Symfony 4? #74

Open

Description

@Jeeppler

Could you provide some information in the README.md on how to configure this bundle in Symfony 4?

Until now I run into the same issue as others have:

However, I think the easiest solution for most of those problems would probably be to add an example configuration for Symfony 4 in the README.md.

Activity

  1. fluchi commented on Oct 10, 2018

    @fluchi
    Contributor

    Hi @Jeeppler,
    Setting up this on Symfony 4 is slight different.

    1. Add you Mailgun credentials on .env.dist (add the same lines on .env, just in case)
    MAILGUN_DOMAIN=<your domain>
    MAILGUN_API_KEY=<your key>
    MAILGUN_SENDER=<your sender>
    
    
    1. Adding on AppKernel, now config/bundles.php
      cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle::class => ['all' => true],

    2. Configuring credentials:
      Create a new config file on config/packages/mailgun.yaml (if it's not there) and copy the following lines:

    cspoo_swiftmailer_mailgun:
        key: '%env(MAILGUN_API_KEY)%'
        domain: "%env(MAILGUN_DOMAIN)%"
    
    services:
        Mailgun\Mailgun:
            class: Mailgun\Mailgun
            factory: ['Mailgun\Mailgun', create]
            arguments: ['%env(MAILGUN_API_KEY)%']
    
    1. Add the following line on config/packages/swiftmailer:
    swiftmailer:
        # url: '%env(MAILER_URL)%'
        transport: 'mailgun'
        spool: { type: 'memory' }
    

    p.s.: Not sure if you really have to comment url

    1. Test your setup with the following command on your terminal:
      bin/console swiftmailer:email:send --from=<from email> --to=<to email> --subject="Foo" --body="Bar"

    With this setup, I've made it work.
    Let me know if I miss something on it.

    Felipe

  2. Jeeppler commented on Oct 10, 2018

    @Jeeppler
    Author

    @fluchi thank you. Awesome. Do you want add your explanation to the README.md (create pull request)?

  3. PhongNguyen512 commented on Nov 9, 2018

    @PhongNguyen512

    @fluchi I'm not sure about my situation, but after I installed the bundle. In my config directory, it just add mailgun.yaml. I can't find any find like swiftmailer.yaml or swiftmail.* .So my site is crashing now. Not sure what to do

  4. fluchi commented on Nov 10, 2018

    @fluchi
    Contributor

    @PhongNguyen512, try to create those files manually. On my case, they weren't create via composer due to permission issues (if I'm non mistaken). Then I've create them manually and everything works fine.

  5. PhongNguyen512 commented on Nov 11, 2018

    @PhongNguyen512

    @fluchi Before I posted my question, I also tried to create swiftmailer.yaml file in config/packages. But I got another error
    There is no extension able to load the configuration for "swiftmailer" (in /home/vagrant/code/project1/config/packages/swiftmailer.yaml). Looked for namespace "swiftmailer", found "framework", "web_profiler", "twig", "monolog", "debug", "sensio_framework_extra", "security", "doctrine_cache", "do ctrine", "doctrine_migrations", "maker", "cspoo_swiftmailer_mailgun"

    I also check in vendor/ . I saw cspoo, swiftmailer and mailgun directories in there. I'm not sure where did I go wrong.

  6. infomaniac50 commented on Feb 7, 2019

    @infomaniac50

    p.s.: Not sure if you really have to comment url

    If MAILER_URL is equal to null://localhost then it will definitely interfere.

  7. PhongNguyen512 commented on Feb 11, 2019

    @PhongNguyen512

    @infomaniac50 I already solved this issue. In my case, I install swiftmailer first I install this bundle. I think the swiftmailer in this bundle does not exist. Therefore, I install swiftmailer first and it works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions