diff --git a/core/domains/domain_edit.php b/core/domains/domain_edit.php
index ea6283a487..ba00f1f0cc 100644
--- a/core/domains/domain_edit.php
+++ b/core/domains/domain_edit.php
@@ -105,6 +105,21 @@
$msg = '';
if (empty($domain_name)) { $msg .= $text['message-required'].$text['label-name']."
\n"; }
//if (empty($domain_description)) { $msg .= $text['message-required'].$text['label-description']."
\n"; }
+
+ //check for a duplicate domain name
+ if ($action == 'add') {
+ $sql = "select count(*) from v_domains ";
+ $sql .= "where domain_name = :domain_name ";
+ $sql .= "and destination_type = 'inbound' ";
+ $parameters['domain_name'] = $domain_name;
+ $num_rows = $database->select($sql, $parameters, 'column');
+ if ($num_rows > 0) {
+ $msg .= $text['message-duplicate']."
\n";
+ }
+ unset($sql, $parameters, $num_rows);
+ }
+
+ //show the message if it's not empty
if (!empty($msg) && empty($_POST["persistformvar"])) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";