in reply to Finding supported ESMTP Extensions with Net::SMTP

I think you want to use: warn "DSN not supported!" unless $smtpc->command('supports', 'DSN');

Replies are listed 'Best First'.
Re: Finding supported ESMTP Extensions with Net::SMTP
by dub4u (Sexton) on Jan 14, 2003 at 21:24 UTC
    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.

        Hmm, depends on the definition of 'works' maybe :) Your solution doesn't result in any error or so, but it doesn't really test if the SMTP server supports DSN!

        Did you try $smtpc->command('supports', 'DSN') with two SMTP servers, one which supports DSN and one that doesn't? I believe your approach wouldn't catch SMTP servers that do not support DSN. I believe Net::Cmd::command() is used to send protocol-level commands to the remote server.

        However, checking if DSN is supported doesn't need interaction with the remote server. Upon creation of a Net::SMTP object, the object sends EHLO to the remote server and the remote server responds with the supported ESMTP extensions, which Net::SMTP stores in $self->{net_smtp_esmtp}. When called, Net::SMTP::supports() queries this hash.

        Now you probably ask yourself, if this guy knows so much about this stuff, then why did he get stuck with the trivial defined. I think there is a point in that question... LOL