Symfony 4 SwiftMailer not sending emails









up vote
0
down vote

favorite












I'm trying to send an email from a Symfony 4 controller, followed the instructions on on the Symfony 4 docs (https://symfony.com/doc/current/email.html).



My .env has the following:



//.env
MAILER_URL=smtp://mail.********.com:465?encryption=ssl&auth_mode=login&username=support@********.com&password=*********

//swiftmailer.yml
swiftmailer:
url: '%env(MAILER_URL)%'
spool: type: 'memory'


To confirm that those settings work, I ran the following in CLI:



php bin/console swiftmailer:email:send

SwiftMailer's Interactive Email Sender
======================================

From:
> support@******.com

To:
> *****@******.com

Subject:
> Testing Swift

Body:
> This is using the cmdline swiftmailer


[OK] 1 emails were successfully sent.


I checked my email and it worked. Email arrived as expected and I assumed there was nothing else to configure.



From the controller I do this:



public function emailTest(Swift_Mailer $mailer)

$message = (new Swift_Message())

// Give the message a subject
->setSubject('My test email')

// Set the From address with an associative array
->setFrom(['support@*********.com' => 'someName'])

// Set the To addresses with an associative array (setTo/setCc/setBcc)
->setTo(['**********@gmail.com'])

// Give it a body
->setBody('Test email from Symfony 4.1 Controller')
;

echo $mailer->send($message);



This the "$mailer->send($message)" returns 1 (True). However, no email was ever sent. I checked the server logs, nothing, I checked the php error longs, nothing. I'm not sure what else to try???










share|improve this question























  • what environment are you in?
    – Dirk J. Faber
    Nov 12 at 9:32










  • Mails will also be captured by the Symfony debug toolbar, does it show up? And what exactly is $mailer?
    – Kevin
    Nov 12 at 12:09















up vote
0
down vote

favorite












I'm trying to send an email from a Symfony 4 controller, followed the instructions on on the Symfony 4 docs (https://symfony.com/doc/current/email.html).



My .env has the following:



//.env
MAILER_URL=smtp://mail.********.com:465?encryption=ssl&auth_mode=login&username=support@********.com&password=*********

//swiftmailer.yml
swiftmailer:
url: '%env(MAILER_URL)%'
spool: type: 'memory'


To confirm that those settings work, I ran the following in CLI:



php bin/console swiftmailer:email:send

SwiftMailer's Interactive Email Sender
======================================

From:
> support@******.com

To:
> *****@******.com

Subject:
> Testing Swift

Body:
> This is using the cmdline swiftmailer


[OK] 1 emails were successfully sent.


I checked my email and it worked. Email arrived as expected and I assumed there was nothing else to configure.



From the controller I do this:



public function emailTest(Swift_Mailer $mailer)

$message = (new Swift_Message())

// Give the message a subject
->setSubject('My test email')

// Set the From address with an associative array
->setFrom(['support@*********.com' => 'someName'])

// Set the To addresses with an associative array (setTo/setCc/setBcc)
->setTo(['**********@gmail.com'])

// Give it a body
->setBody('Test email from Symfony 4.1 Controller')
;

echo $mailer->send($message);



This the "$mailer->send($message)" returns 1 (True). However, no email was ever sent. I checked the server logs, nothing, I checked the php error longs, nothing. I'm not sure what else to try???










share|improve this question























  • what environment are you in?
    – Dirk J. Faber
    Nov 12 at 9:32










  • Mails will also be captured by the Symfony debug toolbar, does it show up? And what exactly is $mailer?
    – Kevin
    Nov 12 at 12:09













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm trying to send an email from a Symfony 4 controller, followed the instructions on on the Symfony 4 docs (https://symfony.com/doc/current/email.html).



My .env has the following:



//.env
MAILER_URL=smtp://mail.********.com:465?encryption=ssl&auth_mode=login&username=support@********.com&password=*********

//swiftmailer.yml
swiftmailer:
url: '%env(MAILER_URL)%'
spool: type: 'memory'


To confirm that those settings work, I ran the following in CLI:



php bin/console swiftmailer:email:send

SwiftMailer's Interactive Email Sender
======================================

From:
> support@******.com

To:
> *****@******.com

Subject:
> Testing Swift

Body:
> This is using the cmdline swiftmailer


[OK] 1 emails were successfully sent.


I checked my email and it worked. Email arrived as expected and I assumed there was nothing else to configure.



From the controller I do this:



public function emailTest(Swift_Mailer $mailer)

$message = (new Swift_Message())

// Give the message a subject
->setSubject('My test email')

// Set the From address with an associative array
->setFrom(['support@*********.com' => 'someName'])

// Set the To addresses with an associative array (setTo/setCc/setBcc)
->setTo(['**********@gmail.com'])

// Give it a body
->setBody('Test email from Symfony 4.1 Controller')
;

echo $mailer->send($message);



This the "$mailer->send($message)" returns 1 (True). However, no email was ever sent. I checked the server logs, nothing, I checked the php error longs, nothing. I'm not sure what else to try???










share|improve this question















I'm trying to send an email from a Symfony 4 controller, followed the instructions on on the Symfony 4 docs (https://symfony.com/doc/current/email.html).



My .env has the following:



//.env
MAILER_URL=smtp://mail.********.com:465?encryption=ssl&auth_mode=login&username=support@********.com&password=*********

//swiftmailer.yml
swiftmailer:
url: '%env(MAILER_URL)%'
spool: type: 'memory'


To confirm that those settings work, I ran the following in CLI:



php bin/console swiftmailer:email:send

SwiftMailer's Interactive Email Sender
======================================

From:
> support@******.com

To:
> *****@******.com

Subject:
> Testing Swift

Body:
> This is using the cmdline swiftmailer


[OK] 1 emails were successfully sent.


I checked my email and it worked. Email arrived as expected and I assumed there was nothing else to configure.



From the controller I do this:



public function emailTest(Swift_Mailer $mailer)

$message = (new Swift_Message())

// Give the message a subject
->setSubject('My test email')

// Set the From address with an associative array
->setFrom(['support@*********.com' => 'someName'])

// Set the To addresses with an associative array (setTo/setCc/setBcc)
->setTo(['**********@gmail.com'])

// Give it a body
->setBody('Test email from Symfony 4.1 Controller')
;

echo $mailer->send($message);



This the "$mailer->send($message)" returns 1 (True). However, no email was ever sent. I checked the server logs, nothing, I checked the php error longs, nothing. I'm not sure what else to try???







symfony swiftmailer symfony4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 18:25

























asked Nov 12 at 6:20









Speedy059

1079




1079











  • what environment are you in?
    – Dirk J. Faber
    Nov 12 at 9:32










  • Mails will also be captured by the Symfony debug toolbar, does it show up? And what exactly is $mailer?
    – Kevin
    Nov 12 at 12:09

















  • what environment are you in?
    – Dirk J. Faber
    Nov 12 at 9:32










  • Mails will also be captured by the Symfony debug toolbar, does it show up? And what exactly is $mailer?
    – Kevin
    Nov 12 at 12:09
















what environment are you in?
– Dirk J. Faber
Nov 12 at 9:32




what environment are you in?
– Dirk J. Faber
Nov 12 at 9:32












Mails will also be captured by the Symfony debug toolbar, does it show up? And what exactly is $mailer?
– Kevin
Nov 12 at 12:09





Mails will also be captured by the Symfony debug toolbar, does it show up? And what exactly is $mailer?
– Kevin
Nov 12 at 12:09


















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256822%2fsymfony-4-swiftmailer-not-sending-emails%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53256822%2fsymfony-4-swiftmailer-not-sending-emails%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線