Subscribe Newsletter

Your Name  : 
Email Address *  : 
  • MDunkleSr: Do you know of a way to get the full post variable using JInput? And...
  • brijmohankaradia: @Awkens @Darkblack add below line before while:...
  • brijmohankaradia: @Awkens @Darkblack add below line before while:...
  • Ahsan: Dear Bala-Krishna, I Was installing CATEGORY SEO META TAGS Plugin in my...
  • PNR Enquiry: Thanks for sharing all these website but you need one more i.e...
  • Train PNR Status: I usually use for checking Railway PNR Status...
  • Online Pnr Status: Before moving on let me tell you that your article was really...
  • Irctc Pnr Check: First of all, thanks for sharing such a valuable piece of...
  • Berita Terbaru: Thanks for tips! helpful..
  • pnrworld: Just by one click now a days passengers can check there current status...
  • remote backup service: Disaster recovery plan with certain objectives like backup...
  • ??? ?????? 2013: Microsoft Extended Windows 7 Enterprise 90-day Trial Download...
  • Indian Railway PNR Status Check: We can check PNR status online, via SMS and even...
  • Archives

  • Blog Stats

How to Fix Swift Mailer Error Address in mailbox given does not comply with RFC

Swift Mailer is an robust object oriented library written in PHP5 with lot of useful features. It can be used with any PHP application developed in PHP5. Symfony, Typo3 framework as well as many other open source framework uses this library. The error i am talking about seems to be a common error and lot of people talking on the web about it. I personally encountered this error with Symfony framework when i was trying to send an email to user after registration. The script thrown following error:

Fatal error: Uncaught exception ‘Swift_RfcComplianceException’ with message ‘Address in mailbox given [] does not comply with RFC 2822, 3.6.2.’ in

The exception itself says there is something wrong in email address fields such as From, Sender or Reply-To fields. Swift Mailer strictly follow RFC standard to avoid emails being caught by spam checker tools. There are following reason can lead to this error.

  • Incorrect email address format in to,from or reply-to fields
  • Email address or host does not exist
  • From email address should be valid working email address
  • Not fully qualified domain name used in from email address

To fix this error check above settings in you script and fix accordingly. You may need to check RFC standard to fix this error. If still does not fix error you can disable email address RFC standard checking code in swift mailer script. Obviously this is not recommended but some time developer need to apply fix temporarily.

Before applying please check Swift Mailer documentation on how to set To,From,Cc, Bcc, Reply To fields correctly in Swift Mailer.

How To Disable RFC Standard Check

Go to swiftmailer\classes\Swift\Mime\Headers folder and open MailboxHeader.php file in editor. Go to line number 304 and comment throw exception line as specified below.

For Symfony users: swift mailer library can be found in vendor folder.

private function _assertValidAddress($address)
  if (!preg_match('/^' . $this->getGrammar('addr-spec') . '$/D',
    //throw new Swift_RfcComplianceException(
    //  'Address in mailbox given [' . $address .
    //  '] does not comply with RFC 2822, 3.6.2.'
    //  );

The error should be disappear now.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply