• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Resolved Blacklist specific domain for Incoming Email

othmaqsa

Regular Pleskian
Server operating system version
20.04.4 LTS
Plesk version and microupdate number
18.0.45 Update #2
Hello,

Is there a way to ban incoming emails for specific domains such as @support.ru , admin.ru etc?

I receive a dozen / days, sent through the contact form on a Wordpress site.

Will setting up a WAF modsecurity solve this problem?

Thank you
 
Hello @Dave W ,

Thank you for your response.

I have already tried to blacklist the whole domain with the method you have mentioned (example: *@inbox.ru), but the email still coming from this domain.
 
I would suggest that you configure your contact form to use an SMTP connection rather than phpmail so that you are sure that mail is being sent through the spam filters. Also..strong captcha.
 
Hello @Dave W ,

I come back to you regarding the configuration of SMTP with Wordpress.

I prefer to implement the code directly in wp-config.php and functions.php instead of using a plugin.

I added this on functions.php:

Code:
// Send email via SMTP
add_action('phpmailer_init', 'send_smtp_email');
function send_smtp_email( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = SMTP_HOST;
$phpmailer->SMTPAuth = SMTP_AUTH;
$phpmailer->Port = SMTP_PORT;
$phpmailer->Username = SMTP_USER;
$phpmailer->Password = SMTP_PASS;
$phpmailer->SMTPSecure = SMTP_SECURE;
$phpmailer->From = SMTP_FROM;
$phpmailer->FromName = SMTP_NAME;
}

I then added this to wp-config.php:

Code:
// SMTP email settings
define('SMTP_USER', '[email protected]'); // Username to use for SMTP authentication
define('SMTP_PASS', 'mypassword'); // Password to use for SMTP authentication
define('SMTP_HOST', 'mysmtphost'); // The hostname of the mail server
define('SMTP_FROM', '[email protected]'); // SMTP From email address
define('SMTP_NAME', 'MyWebsite'); // SMTP From name
define('SMTP_PORT', '465'); // SMTP port number - e.g. 25, 465 or 587
define('SMTP_SECURE', 'ssl'); // Encryption system to use - ssl or tls
define( 'SMTP_AUTH', true ); // Use SMTP authentication (true|false)

Question: As you notice, I put as port 465 (which is mentioned in the config on Plesk and I put SSL instead of TLS

Do you have an idea why the config does not work with TLS + port 465?

I did several tests, the TLS works if I replace 465 by 587.

Thank you
 
Back
Top