Am 13.10.2014 um 12:12 schrieb Mike Cardwell:
* on the Mon, Oct 13, 2014 at 11:51:04AM +0200, li...@rhsoft.net wrote:
Is there any way of asking Postfix if it thinks it is capable of
delivering a message to a particular email address, in real time?
With Exim installed, I could just do a
"sendmail -bv some.addr...@example.com" and check the exit code.
With Postfix installed, the exit code is always 0 and the result
of the lookup is emailed to me instead.
This functionality is very useful for doing "real time" email
address validation when email addresses are posted from web forms
you should avoid that for two reasons:
* automated form submits may lead in blacklisting because
it results in a delivery attempt behind the scenes
http://www.postfix.org/ADDRESS_VERIFICATION_README.html
Address verification is always a guess. You're assuming that by address
verification I'm talking about actually connecting to the remote SMTP
server and sending "RCPT TO". I'm not talking about that, I'm talking
about asking Postfix if the syntax of the address is valid and if the
DNS is set up suitably to be able to potentially be able to deliver
the message. I.e, are there valid MX records etc. That is how Exim
does it at least.
i doubt: https://github.com/Exim/exim/wiki/Verification
for a formal check without verification you don't need a MTA
http://search.cpan.org/~rjbs/Email-Valid-1.195/lib/Email/Valid.pm
http://search.cpan.org/~nlnetlabs/Net-DNS-0.80/lib/Net/DNS.pm
BTW - the MX record is not mandatory
if not present the MTA falls back to the A record!
* if your webserver is able to execute shell commands
the setup is highly questionable
I don't agree. Executing the following Perl from a CGI script is
completely safe:
my $valid = eval {
open(my $output, '-|', '/usr/sbin/sendmail', '-bv', $email_address);
close $output;
return $? == 0 ? 1 : 0;
};
if it is done safe and secure - you know every scripts
present on your webserver are audited and safe and don't
use unsanitized user inputs? doubt!
hence in case of PHP:
disable_functions = "apache_child_terminate, chown, dl, exec, fileinode,
get_current_user, getmypid, getmyuid, getrusage, highlight_file, link,
mail, openlog, passthru, pclose, pcntl_alarm, pcntl_errno, pcntl_exec,
pcntl_fork, pcntl_get_last_error, pcntl_getpriority, pcntl_setpriority,
pcntl_signal_dispatch, pcntl_signal, pcntl_sigprocmask,
pcntl_sigtimedwait, pcntl_sigwaitinfo, pcntl_strerror, pcntl_wait,
pcntl_waitpid, pcntl_wexitstatus, pcntl_wifexited, pcntl_wifsignaled,
pcntl_wifstopped, pcntl_wstopsig, pcntl_wtermsig, pfsockopen, popen,
posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid,
proc_close, proc_get_status, proc_nice, proc_open, proc_terminate,
shell_exec, show_source, socket_accept, socket_bind, symlink, syslog,
system"