-
-
Save lolautruche/24ef45a36a50b0bd8acb to your computer and use it in GitHub Desktop.
EZP-23389: ezcMailComposer bug when sending e-mails with long name and Norwegian 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
<?php | |
/** | |
* Created by PhpStorm. | |
* User: lolautruche | |
* Date: 31/10/2014 | |
* Time: 14:39 | |
*/ | |
namespace Acme\TestBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | |
use Symfony\Component\Console\Input\InputInterface; | |
use Symfony\Component\Console\Output\OutputInterface; | |
class EzcMailTestCommand extends ContainerAwareCommand | |
{ | |
protected function configure() | |
{ | |
$this->setName( 'test:ezcmail' ); | |
} | |
public function execute( InputInterface $input, OutputInterface $output ) | |
{ | |
$from = [ | |
'email' => 'no-reply@ez.no', | |
'name' => 'From name ØÆÅ test vive le sucre from ouais with a very long name which contains norwegian characters ÆØÅæøÅ' | |
]; | |
$to = [ | |
// Change with your e-mail address | |
'email' => 'jv@ez.no', | |
'name' => 'To ØÆÅ Name test même que c\'est pas drôle quand ça plante with a very long name which contains norwegian characters ÆØÅæøÅ' | |
]; | |
$subject = 'Test øæå ØÆÅ subject test test test with a very long name which contains norwegian characters ÆØÅæøÅ that need to be handled correctly,'; | |
$content = "Test of & content."; | |
$charset = 'utf-8'; | |
$mail = new \ezcMailComposer(); | |
$mail->charset = $charset; | |
$mail->subjectCharset = $charset; | |
$mail->from = new \ezcMailAddress( $from['email'], $from['name'], $charset ); | |
$mail->addTo( new \ezcMailAddress( $to['email'], $to['name'], $charset ) ); | |
$mail->subject = $subject; | |
$mail->plainText = $content; | |
$mail->build(); | |
$transport = new \ezcMailMtaTransport(); | |
$transport->send( $mail ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment