swiftmailer-mailgun-bundle
swiftmailer-mailgun-bundle copied to clipboard
How to configure this bundle in Symfony 4?
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:
- The child node "key" at path "cspoo_swiftmailer_mailgun" must be configured.
- Symfony 4 issue MailgunTransporter not set
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
.
Hi @Jeeppler, Setting up this on Symfony 4 is slight different.
- 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>
-
Adding on AppKernel, now config/bundles.php
cspoo\Swiftmailer\MailgunBundle\cspooSwiftmailerMailgunBundle::class => ['all' => true],
-
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)%']
- 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
- 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
@fluchi thank you. Awesome. Do you want add your explanation to the README.md (create pull request)?
@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
@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.
@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.
p.s.: Not sure if you really have to comment url
If MAILER_URL
is equal to null://localhost
then it will definitely interfere.
@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.