print_header("Mail server routing");

#$domainname = "ieinternet.com";
$mail_routing = find_mail_routing($domainname);

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

if ( $mail_routing eq "remote" ) {

	print qq!
	
	Your email is not being protected by MailWall, IE Internet's email protection service. As a result, your email
	is not being scanned for Viruses and Spam by MailWall. Below is a summary of your current email set-up, listing your
	mail servers in order of priority:<BR><BR>

	!;

	@mailservers = find_mail_servers($domainname);
	$num_mailservers = @mailservers;
	print "<table width=30% border=0 class=text>";
	for ( $i = 0 ; $i < $num_mailservers ; $i++ )
	{
		print "<TR><TD width=10%>&nbsp;</TD><TD>";
		($preference, $mailservername) = split (/\s+/, $mailservers[$i]);
		if ( $i == 0 )
		{
			print "<i>Primary</i>:</TD>";
		} else {
			print "<i>Backup $i</i>:</TD>";
		}
		print "<TD>$mailservername</TD></TR>";
	}
	print "</table><BR>";

	print qq!

	IE Internet recommend that you pass your emails through our MailWall system, in order to protect your internal systems
	from Viruses and Spam. MailWall protection is included as part of your current $hostingplan hosting plan. If you would like to 
	change your set-up please contact us.<BR><BR>

	!;
	print_support_contact_information();
	
} else {
	if ( $mail_routing eq "local" ) 
	{
		print "Your email is being scanned by MailWall, IE Internet's email protection service.<BR><BR>";
	} else {
		# Mail is smtp forwarding

		print qq!
	
		Your email is being protected by MailWall, IE Internet's email protection service, before being forwarded to
		your mail server.<BR><BR>

		!;

		show_status_of_service( "on", $reset_smtp_forwarding, "Forwarding to $mail_routing" );
		print "<BR>";
	}

	print_header("MailWall Services");

	if ( ( $hostingplan ne "SOHO" ) || ( check_if_allowed_on_soho("is_anti-virus_allowed_for_soho") eq "yes" ) )
	{
		$virus_status = virus_scanning_status($domainname);

		if ($virus_status eq "off" )
		{
			show_status_of_service( "off", $turn_on_virus, "Virus Scanning" );
		} else {
			show_status_of_service( "on", $turn_off_virus, "Virus Scanning" );
			show_status_of_service( "on", $quarantine_management_1, "Quarantine Management" );
		}
	}

	if ( ( $hostingplan ne "SOHO" ) || ( check_if_allowed_on_soho("is_anti-spam_allowed_for_soho") eq "yes" ) )
	{
		$spam_status = spam_scanning_status($domainname);
		if ($spam_status eq "off" )
		{
			show_status_of_service( "off", $turn_on_spam, "Spam Scanning" );
		} else {
			show_status_of_service( "on", $turn_off_spam, "Spam Scanning" );	
			$spam_trap_status = spam_actions_status($domainname);
			if ( $spam_trap_status eq "off" )
			{
				show_status_of_service( "off", $turn_on_spamtrap, "Spam Trap" );
			} else {
				show_status_of_service( "on", $turn_off_spamtrap, "Spam Trap" );
			}
		}
	}

}


