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.
| [reply] [d/l] |
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
| [reply] [d/l] [select] |
D'oh! I feel really stupid now. I did indeed try it out with two different servers, one of which *should* support DSN. And you are correct, I was under the assumption that supports('DSN') should have been sent to the server.
| [reply] [d/l] |