View Single Post
Old June 23rd, 2006, 04:11 AM
MightyThor MightyThor is offline
Registered User
Join Date: Jun 2006
Location: Edinburgh, , United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

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 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";


$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);


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.