473,542 Members | 16,239 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting Fatal error: Uncaught exception 'Swift_RfcComplianceException'

245 New Member
Hey all,
I am using Swift mailer and i am getting error

"Fatal error: Uncaught exception 'Swift_RfcComplianceException' with message 'Address in mailbox given [0] does not comply with RFC 2822, 3.6.2.' " while sending email through swift Mailer. Can some body tell me what is the reason behind of getting this error and how can i fix that error. I will be very thankful to him/her for solving my problem as my work stop due to this error

kind regards,
Mohsin Rafique
Mar 18 '09 #1
5 10018
8,658 Recognized Expert Moderator Expert
first, which Swift version are you using (Swift 4.0 was recently published)?

to prevent an uncaught Exception you need to enclose your code in a try-catch block
Expand|Select|Wrap|Line Numbers
  1. try {
  2.     // your code
  3. }
  4. catch (Exception $e)
  5. {
  6.     // fallback code here
  7. }
or use a default Exception handler (set_exception_handler()).

the Exception states that either the From, Sender or Reply-To header does not adhere to the standard (see RFC 2822). I need to see the code of that to tell you more.

Mar 18 '09 #2
245 New Member
First of all Thank you for your reply.
Well sir i recently download the swift mailer script 4 days ago and i am not sure which version is this. But here is my code sir

Expand|Select|Wrap|Line Numbers
  1. require_once 'lib/swift_required.php';
  2.             $transport = Swift_MailTransport::newInstance();
  3.             //Create the Mailer using your created Transport
  4.             $mailer = Swift_Mailer::newInstance($transport);
  5.             $message = Swift_Message::newInstance()
  6.             //Give the message a subject
  7.             ->setSubject('One Owner Car Password Reset Confirmation')
  9.             //Set the To addresses with an associative array
  10.             ->setTo(array($email => $customer_name))
  11.             //->setTo(array('mohsin.rafique@ewconsultinginc.com' => 'Louise'))
  13.             //Set the From address with an associative array
  14.               ->setFrom(array($from => $from_name))
  16.             //A Sender: address specifies who sent the message and is set with the setSender() method of the message.
  17.             ->setSender($no_reply)
  19.             //The Return-Path: address specifies where bounce notifications should be sent and is set with the setReturnPath() method of the message.
  20.             ->setReturnPath($bounce)
  22.             //Set Priority 1=Highest, 2=High, 3=Normal, 4=Low, 5=Lowest
  23.             ->setPriority(2)
  25.             //Give it a body
  26.               ->setBody('
  27.             <table cellspacing="0" cellpadding="0" border="0" align="left" width="570" style="font-family:Arial;font-size:12px;color:#000000;">
  28.                 <tr><td><font style="font-size:18px;font-weight:bold;">Hey '.$customer_name.'</font></td></tr>
  29.                 <tr><td>&nbsp;</td></tr>
  30.                 <tr>
  31.                     <td>
  32.                     You recently requested a new password.  To reset your password, follow the link below:<br />
  33.                     <a href="'.PATH_WEB.'reset.php?sid='.$sid.'&amp;cid='.$cid.'" style="text-decoration:none; color:#333333;">'.PATH_WEB.'reset.php?sid='.$sid.'&amp;cid='.$cid.'</a><br /><br />
  34.                     <em>(If clicking on the link doesn&acute;t work, try copying and pasting it into your browser.)</em><br />
  35.                     Please do not close your browser until the password page completely loads, which may take several minutes.<br /><br />
  36.                     If you did not reset your password, please disregard this message.
  37.                      </td>
  38.                    </tr>
  39.                 <tr><td style="border-bottom:1px dashed #333333;">&nbsp;</td></tr>
  40.                 <tr><td>Please do not reply to this email, as this mailbox is not monitored.<br />Thanks<br /><a href="http://www.oneownercar.com.au">One Owner Car Team</a></td></tr>
  41.             </table>
  42.             ', 'text/html')
  43.             ;
  44.             if ($mailer->send($message)){
  45.                 echo "
  46.                 <form name='forgotForm' id='forgotForm' method='post' action='reset.php'>
  47.                     <input type='hidden' name='confirmation' id='confirmation' value='done' />
  48.                     <input type='hidden' name='email_confirmation' id='email_confirmation' value='".$email."' />
  49.                     <input type='submit' style='visibility:hidden' />
  50.                 </form>
  51.                 <script type='text/javascript'>document.forgotForm.submit();</script>
  52.                 ";
  53.                 exit();
  54.             }else{
  55.                 echo "
  56.                 <form name='forgotForm' id='forgotForm' method='post' action='reset.php'>
  57.                     <input type='hidden' name='confirmation' id='confirmation' value='Error sending email' />
  58.                     <input type='submit' style='visibility:hidden' />
  59.                 </form>
  60.                 <script type='text/javascript'>document.forgotForm.submit();</script>
  61.                 ";
  62.                 exit();
  63.             }
Mar 18 '09 #3
8,658 Recognized Expert Moderator Expert
are you sure that $from, $no_reply and $bounce are correctly set?

to get more info from the Exception try
Expand|Select|Wrap|Line Numbers
  1. try {
  2.     // swift code
  3. }
  4. catch (Exception $e)
  5. {
  6.     echo $e->getTraceAsString();
  7. }
Mar 18 '09 #4
245 New Member
Thanks again sir! It fixed automatically without using try catch block
Mar 19 '09 #5
8,658 Recognized Expert Moderator Expert
good. but you should load a default exception handler, you never know when the next Exception will be thrown.
Mar 19 '09 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

by: mkoonani | last post by:
Hi, i am getting the following error while using js to communicate between parent and child windows using Firefox browser. Can anyone help me out from this.? MK
by: funktacular | last post by:
Hi - I have some javascript that works when I run it from a server, but I need to run it locally. When I try to execute it locally I get the following error: Error: uncaught exception: Permission denied to get property Window.processXML Is there a way to get around this issue? default.htm
by: xhunter | last post by:
Hi, I have written my code to load some content through ajax, which works perfectly, then I thought of adding a timeout to retry the action in case it has failed or something. here is the code : var requestTimer = setTimeout(function() { xmlHttp.send(post); }, 10000);
by: friend | last post by:
how to correct the following error? is anybody there to help? i am getting this error from error console . Error: uncaught exception: " nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhosti/test/latest.php?id=1 :: centrePopup :: line 22" data: no]
by: dmjpro | last post by:
I am getting this error in a Mozilla ..what causes this ? Basically i m setting this property to top, it is running in an application finely. But i am calling this application from another application then it is giving this error ... Could you please help me out ...?
by: neovantage | last post by:
Hey all, I am getting Fatal error: Unable to read 4761 bytes. Can some one guide me how to fix this error. I have the latest version of Zend Optimizer on my server., So Zend is not the issue other than this does some has it's actauly solutions? Here is the url of ERROR PAGE i am badly stuck in it. Kindly help me out to sort out my problem....
by: yashmistrey | last post by:
I am getting error on signup at <URL removed at request of poster>
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.