#!/usr/bin/perl -w

use strict;

my @smtp = qw(	custom
				smtp.free.fr
				smtp.wanadoo.fr
				smtp.neuf.fr
				);
print "Available smarthosts :\n";

for (my $i = 0; $i < @smtp; ++$i) { print "$i : $smtp[$i]\n" } 

print "What's the best fit pal ? ";

chomp(my $r = <STDIN>);

if (!int($r)) {
	print "Please enter your custom smarthost address : ";
	chomp( $r = <STDIN> );
}
else {
	$r = $smtp[$r];
}

$r &&= sprintf  "sed -i 's/dc_smarthost=.*/dc_smarthost=%s/'" .
                " " .
                "/etc/exim4/update-exim4.conf.conf" . 
                ";" .
                "/etc/init.d/exim4 reload", $r;
print qx($r);

=head1 NAME

B<exim4_smarthost_update.pl>

=head1 DESCRIPTION

Update Exim4 Debian config with a choosen SMTP smarthost.

=head1 COPYRIGHT

Copyright 2000-2007 Etienne LEMEE <coding AT etilem DOT net>

This piece of code is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

=cut
