#!/usr/bin/perl

print "Content-Type: Text/HTML\n\n";

use CGI ':standard';
use Vpanel 1.00;
require $header;
require $accountinfo;

$domainname = find_domain ($mainuser);
$hostingplan = find_hosting_plan ($domainname);
$smtpforwarding = is_mailertable ($domainname);

# Define the tab which appears to the front
$tab_section = $tabnum_email;

# Output the content associated with this tab
print "<body class=section-$tab_section>";

# display tabs
require $tabdisplay;

print_header ("View your current email set-up");

$mail_routing = find_mail_routing($domainname);

# if ( ( $mail_routing ne "remote" ) && ( $mail_routing ne "local") && (!( $mail_routing =~ /.*[0-9]/ ) ) )
if ( ( $mail_routing ne "local") && ( $mail_routing eq "" ) )
{
        quit_with_errors("An error occured with sourcing your email set-up.");
}

if ( $mail_routing eq "remote" ) {
	print qq!
	As your email is not being routed through IE Internet's mail servers, there are no email facilities open to you at the moment.<BR><BR>
	!;
	print_support_contact_information();
} else {
	# require the front for this tab
	# if account has SMTP forwarding, show limited options, else show full email options
	if ( $smtpforwarding )
	{
		if ( length($smtpforwarding) < 16 )
		{
			require $showsmtpforwarding;
		} else {
			require $showcustomsmtpforwarding;
		}
	} else {	
		require $tab_front[$tab_section-1];
	}
	show_meaning_of_icons();
}
require $footer;
