Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Professional Ajax ISBN: 978-0-471-77778-6
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Ajax ISBN: 978-0-471-77778-6
This is the forum to discuss the Wrox book Professional Ajax by Nicholas C. Zakas, Jeremy McPeak, Joe Fawcett; ISBN: 9780471777786
Important: For the new 2nd edition of this book, please post here instead: [url="http://p2p.wrox.com/forum.asp?FORUM_ID=307"]http://p2p.wrox.com/forum.asp?FORUM_ID=307[/url]
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Ajax ISBN: 978-0-471-77778-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 10th, 2006, 04:52 PM
Registered User
 
Join Date: Jun 2006
Location: Edinburgh, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error when sending mail using the AjaxMail example

Hi,

I've implemented the AjaxMail example from the book and I've encountered an issuse with it when trying to send mail. I get the following error:

"Language string failed to load: recipients_failed"

I'm going to spend some time debugging the code but I was wondering if anyone had any thoughts about this?

Cheers!



  #2 (permalink)  
Old June 22nd, 2006, 07:49 PM
Registered User
 
Join Date: Mar 2005
Location: Greenwood, IN, USA.
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to coders4hire
Default

I received the same error.

Doug
http://www.douglaskarr.com

  #3 (permalink)  
Old June 22nd, 2006, 07:57 PM
nzakas's Avatar
Wrox Author
 
Join Date: Dec 2004
Location: Peabody, MA, USA.
Posts: 217
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Can either of you let me know what you're doing to get this error? I'm not able to see it.

What version of PHP are you running against? What are you doing when the error occurs and what form does the error message take (is it in an alert, is it output onto the page, etc.)?

Thanks

Nicholas C. Zakas
Author, Professional JavaScript for Web Developers (ISBN 0764579088)
http://www.nczonline.net/
  #4 (permalink)  
Old June 23rd, 2006, 04:11 AM
Registered User
 
Join Date: Jun 2006
Location: Edinburgh, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've managed to fix this error but I've noticed another bug in the regex used for splitting names and addresses in the name <address> format.

Anyway, the first error... Unfortunately it's been about two weeks since I posted and I can't remember fully what I did to fix it. I think it turned out that there was an issue with the SQL select statements in AjaxMail.inc.php. They were selecting from table 'From' - with apostrophes - while my DB fieldname didn't have the ' ' marks and I had issue trying to insert them in MySQL 3.2. Eventually I just changed the query located at lines 138 - 140 from

$query = "select MessageId, `To`, `From`, CC, BCC, Subject, Date, ";
$query .= "Message, HasAttachments, Unread from AjaxMailMessages where";
$query .= " MessageId=$messageId";

to

$query = "select * from AjaxMailMessages where";
$query .= " MessageId=$messageId";

Hopefully this will fix your problem Doug.

There also seems to be another bug on line 315 in the sendMail function. The regex isn't working correctly and will return nothing... so e-mails will not get sent as there are no addresses.

My regex is bad but I changed line 315 from

preg_match("/(.*?)<?(.*?)>?/i", $to, $matches);

to

preg_match("/([a-z][a-z0-9_.-\/]*@[^\s\"\)\?<>]+\.[a-z]{2,6})/i", $to, $matches);

and line 318 to $mailer->AddAddress($matches[1], '');

and I can now get e-mails to send (but no names will appear).

If anyone could provide assisting in fixing the regex preg_match("/(.*?)<?(.*?)>?/i", $to, $matches);, I'd greatly appreciate it.

Thanks a lot.



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mail sending error rajuru Beginning PHP 3 October 20th, 2004 01:19 AM
URGENT Error in sending mail qazi_nomi Classic ASP Basics 12 June 25th, 2004 07:42 PM
Urgent Error in sending mail qazi_nomi Classic ASP Components 1 June 11th, 2004 02:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.