473,671 Members | 2,321 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting Fatal error: Uncaught exception 'Swift_RfcCompl ianceException'

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

"Fatal error: Uncaught exception 'Swift_RfcCompl ianceException' 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 10027
Dormilich
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_h andler()).

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.

regards
Mar 18 '09 #2
neovantage
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')
  8.  
  9.             //Set the To addresses with an associative array
  10.             ->setTo(array($email => $customer_name))
  11.             //->setTo(array('mohsin.rafique@ewconsultinginc.com' => 'Louise'))
  12.  
  13.             //Set the From address with an associative array
  14.               ->setFrom(array($from => $from_name))
  15.  
  16.             //A Sender: address specifies who sent the message and is set with the setSender() method of the message.
  17.             ->setSender($no_reply)
  18.  
  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)
  21.  
  22.             //Set Priority 1=Highest, 2=High, 3=Normal, 4=Low, 5=Lowest
  23.             ->setPriority(2)
  24.  
  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.             }
  64.  
Mar 18 '09 #3
Dormilich
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
neovantage
245 New Member
Thanks again sir! It fixed automatically without using try catch block
Mar 19 '09 #5
Dormilich
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

2
1687
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
2
7190
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
9
14135
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);
0
410
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]
6
1859
dmjpro
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 ...?
2
4013
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. Thanks in advance.
7
4769
by: yashmistrey | last post by:
I am getting error on signup at <URL removed at request of poster>
0
8478
marktang
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8599
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7439
agi2029
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6230
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5696
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2813
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
2
2052
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1810
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.