Mantis - Quercus
Viewing Issue Advanced Details
2754 minor always 06-27-08 07:13 08-07-08 20:05
ferg  
ferg  
normal  
closed 3.1.6  
fixed  
none    
none 3.2.1  
0002754: mail with null "to" attribute
(rep by atijms)

I'm trying to run PHPBB2 2.0.23 on Quercus 3.1.6. I noticed that under certain circumstances PHPBB2 uses a " " as the "to" field when sending an email. Apparently this is allowed in real PHP, but it fails on Quercus.

In MailModule.java, line 123 an exception is thrown when basically no emailaddresses with a @ in it can be found. This check for a @ is being done in the addRecipients method:


private static ArrayList addRecipients(MimeMessage msg,
Message.RecipientType type,
String to)
throws MessagingException
{
String []split = to.split("[ \t,<>]");

ArrayList addresses = new ArrayList();

for (int i = 0; i < split.length; i++) {
if (split[i].indexOf('@') > 0) {
Address addr = new InternetAddress(split[i]);

addresses.add(addr);
msg.addRecipient(type, addr);
}
}

return addresses;
}
Now I'm not sure that you really have to check on the @, at least our servers also know of local email addresses which don't have an @ in them. Anyway, the code section in PHPBB2 is this:

PHPBB2 2.0.23, emailer.php, line 209

$empty_to_header = ($to == '') ? TRUE : FALSE;
$to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;

$result = @mail($to, $this->subject, preg_replace("#(?msg), $this->extra_headers);
In this case, running the code on Quercus always causes an exception:


com.caucho.quercus.QuercusModuleException: mail has no recipients
com.caucho.quercus.lib.MailModule.mail(MailModule.java:123)

Notes
(0003308)
ferg   
08-07-08 20:05   
php/1n0{a,b,c}