NAME

Data::Validate::Mailbox - Verify if the given mailbox exists

VERSION

Version 0.13

SYNOPSIS

Verify if the given mailbox exists.

use Data::Validate::Mailbox;

my $mbx = Data::Validate::Mailbox->new;

# or,
my $mbx = Data::Validate::Mailbox->new(debug => 1,
                                       localhost => 'your-domain.org',
                                       localuser => 'user@your-domain.org',
                                      );

my $res = $mbx->validate('user123@gmx.de'); # or
my $res = $mbx->validate('user123@gmail.com'); # or
my $res = $mbx->validate('user123@hotmail.com'); # or 
...

# 1 means existing, 0 means non-existing
print $res;

Please note,

1. This module uses `Net::SMTP` to attempt delivering messages to the peer MTA. If the recipient's mailbox does not exist, the peer MTA will typically respond with an error message like "mailbox unavailable."

2. However, not all providers behave this way. For example, Yahoo and AOL do not provide such responses, so this module will not function correctly with them.

SUBROUTINES/METHODS

new

New the object.

Please note, for many email providers, you have to provide the correct local hostname/username for sending email to them.

The local hostname refers to the hostname of the machine you use to connect to other MTAs, and it corresponds to the parameter of the HELO command in the SMTP session. The local username refers to the email address you use to send messages to external systems, and it corresponds to the parameter of the MAIL FROM command in the SMTP session.

The hostname must match the following conditions.

1. It is your valid domain/hostname.

2. The hostname has an IP address, and a correct PTR for this IP (PTR match back to hostname).

3. The sender domain has valid MX records and/or SPF records.

4. The IP has good reputation (not listed in any DNSBL).

If you can't send messages to external providers (either the program dies or it gets 0 always), please setup your right localhost and localuser options in new() method.

validate

Validate if the given mailbox exists. Return 1 for existing, 0 for non-existing.

AUTHOR

Y Peng, <ypeng at t-online.de>

BUGS

Please report any bugs or feature requests to bug-data-validate-mailbox at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Validate-Mailbox. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Data::Validate::Mailbox

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023 by Y Peng.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)