dub4u has asked for the wisdom of the Perl Monks concerning the following question:

I can't get my head around this. I want to find out if the SMTP server I'm talking to supports the DSN extension (RFC1891). Any help is appreciated, this is what I thought would work:
use strict; use Net::SMTP; my $smtpd = shift @ARGV || 'localhost'; my $smtpc = Net::SMTP->new($smtpd, Debug => 1, ); warn "DSN not supported!" unless $smtpc->supports('DSN');
The warning is always printed, even if the SMTP server I'm talking to supports the DSN extension. (I've tried this with other SMTP extensions too and the results are the same)

I know I'm doing something wrong here when I call the (undocumented) supports() method in Net::SMTP but I don't know what I'm doing wrong there or what else I could do to achieve what I want.

Replies are listed 'Best First'.
Re: Finding supported ESMTP Extensions with Net::SMTP
by Mr. Muskrat (Canon) on Jan 14, 2003 at 17:56 UTC
    I think you want to use: warn "DSN not supported!" unless $smtpc->command('supports', 'DSN');
      Not what I wanted Muskrat but thank you for trying!
      I found the solution in the meantime:
      warn "DSN not supported!" unless defined $smtpc->supports('DSN');
      D'oh!

        That doesn't work on my system but both my first answer and this do:
        warn "DSN not supported!" unless defined $smtpc->command('supports','DSN');

        Go figure.

        I'm glad that you got it working.