-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented the resend email feature and reorganized the way emails a…
…re stored.
- Loading branch information
Showing
13 changed files
with
820 additions
and
492 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace NTI\EmailBundle\Command; | ||
|
||
use NTI\EmailBundle\Entity\Email; | ||
use NTI\EmailBundle\Entity\Smtp; | ||
use Swift_Spool; | ||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Input\InputOption; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class ResendCommand extends ContainerAwareCommand | ||
{ | ||
protected function configure() | ||
{ | ||
$this | ||
->setName('nti:email:resend') | ||
->setDescription("Resends an email by putting it in the spool folder again and changing the status to QUEUE") | ||
->addArgument("emailId", InputArgument::REQUIRED, "The Email Id to be resent") | ||
; | ||
} | ||
|
||
protected function execute(InputInterface $input, OutputInterface $output) | ||
{ | ||
$id = $input->getArgument("emailId"); | ||
if(!$id) { | ||
$output->writeln("<error>The Email ID is required.</error>"); | ||
return; | ||
} | ||
|
||
$em = $this->getContainer()->get('doctrine')->getManager(); | ||
$email = $em->getRepository('NTIEmailBundle:Email')->find($id); | ||
if(!$email) { | ||
$output->writeln("<error>The Email was not found.</error>"); | ||
return; | ||
} | ||
|
||
$smtpService = $this->getContainer()->get('nti.mailer'); | ||
|
||
$smtpService->resend($email); | ||
$output->writeln("<success>The Email was moved to the queue.</success>"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.