Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Valid CPAN distribution.

Report information
The Basics
Id: 80012
Status: rejected
Priority: 0/
Queue: Email-Valid

People
Owner: Nobody in particular
Requestors: ipaton0 [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: failure on trailing garbage at end of address
Date: Thu, 04 Oct 2012 18:50:23 +0100
To: bug-Email-Valid [...] rt.cpan.org
From: Iain Paton <ipaton0 [...] gmail.com>
using Email::Valid 0.190 an address of the form 'something@perl.com ' where there's a trailing character after the .com that's somehow invalid, a space or some corrupt attempt at unicode, Email::Valid will tell me that it's a valid email address. This can be replicated simply by the following: my $r=Email::Valid->address('something@invalid.com '); This seems to be down to reading the passed in address using Mail::Address->parse as follows: ($addr) = Mail::Address->parse( $addr ); Since Mail::Address->parse seems to be intended to extract email addresses from complete lines in email headers it first tokenizes the input, thereby discarding any leading/trailing stuff it doesn't like. Changing Email::Valid to use ($addr)=Mail::Address->new('',$addr); means that it returns an error of fqdn. Of course that could have other effects if people rely on that behaviour somehow. It seems likely that this particular behaviour from Mail::Address->parse is what's behind #75650 as well. Anyway, don't know if this is easily fixable, but thought it was worth reporting anyway.
Thanks. It's annoying, isn't it? I think this is intentional. Note that ->address doesn't return a mere boolean, but a potentially tweaked value. You should always validate with Email::Valid, then use the value you got back, if any. I hope to write a replacement for Email::Valid with a more intuitive API in the future. -- rjbs