Page 1 of 1

BUG? Question marks in email subject for non-English

Posted: Thu Nov 06, 2008 1:39 am
by colnector
First, Swift Mailer is really easy to use and performs very well so far. I'm using the svn version from:
http://swiftmailer.svn.sourceforge.net/ ... 3.3.3/lib/

My international website supports 25 languages and for this reason emails need to be send using these languages.
I'm using a GMail account for sending the emails as text/html.

All looks great except for the subject line which occasionally has question marks. It seems that Swift tries to HTML encode some of the non-English characters and thus creating a wrong subject line (which should probably be plain text).

To see exactly what I mean please go to the main page of my website for collector and try either the 'Create Account' or 'Forgot Password?' features. Change the language to Spanish, for example, and try again. You will see exactly what I mean. Don't worry, my site will not save your email to spam you later.

Here's the code used (I've build a class for my mailing needs and I'm using Symfony):

Code: Select all

 public static function send($mailFrom, $mailTo, $mailSubject, $mailBody) {
    if (empty($mailFrom))   $mailFrom = sfConfig::get('app_email_mailer');
    if (empty($mailTo)) $mailTo = sfConfig::get('app_email_mailer');
        try {
          // Create the mailer and message objects
            $connection = new Swift_Connection_SMTP(sfConfig::get('app_email_host_addr'), 
                465, Swift_Connection_SMTP::ENC_SSL);
            $connection->setUsername(sfConfig::get('app_email_host_user'));
            $connection->setPassword(sfConfig::get('app_email_host_pwd'));
     
            $mailer = new Swift($connection);
          $message = new Swift_Message($mailSubject, $mailBody, 'text/html');
          $message->setReplyTo($mailFrom);
         
          // Send
          $mailer->send($message, $mailTo, $mailFrom);
          $mailer->disconnect();
        }   catch (Exception $e)    {
            throw $e;
          if (isset($mailer)) $mailer->disconnect();         
          // handle errors here
        }   
  }
Many thanks in advance

Re: BUG? Question marks in email subject for non-English

Posted: Sat Nov 15, 2008 7:51 am
by andyb
Please see response in another thread I just replied in, current version of SWIFT has encoding issues with the Subject.

Re: BUG? Question marks in email subject for non-English

Posted: Sun Nov 16, 2008 4:38 am
by colnector
I've just checked theother thread. Too bad :(

Re: BUG? Question marks in email subject for non-English

Posted: Wed Nov 19, 2008 2:58 pm
by andyb
Just to let everyone know, although a supporter of Swiftmail, the lack of support recently has led me to look for other solutions due to some urgent demands.

I have come across a mail class called Nomad. Quite simply it works, where Swiftmail and PHPMailer fail, this works. I can send different languages in utf-8 including embedded images, have Russian text in From and Subject fields and it works!

I hope Chris the Developer of Swiftmail comes back online soon, but in the meantime give Nomad a try!

Re: BUG? Question marks in email subject for non-English

Posted: Fri Dec 05, 2008 10:33 pm
by Chris Corbyn
Sorry about that. All of the encoding bugs have been fixed in version 4 since it's character set aware.

Thanks for pointing out Nomad, I'll have to take a look over the source since I wasn't aware it even existed ;)