SMTP Restrictions and External SMTP providers
All of the mail sent from our server is sent using PHPMailer via SMTP2Go on port 2525.
If I enable SMTP Restrictions, will it prevent our mail from being sent?
-
Hey hey! Probably - does your form authenticate to any specific account on the server?
0 -
cPanel SMTP Restrictions blocks port 25, 465 & 587, so if you send on port 2525 you should be fine.
Then of course tcp port 2525 out must be open in the firewall.
0 -
That's a good point - since the port is customized the SMTP Restrictions may not apply here at all!
0 -
Yes—this works fine.
We run with SMTP Restrictions enabled and relay mail from apps via an external provider. SMTP Restrictions only blocks user processes from using 25/465/587; using a custom port (e.g., 2525) continues to work.
Checklist
-
Open outbound TCP 2525 in the server firewall.
-
In your app (PHPMailer), use AUTH + STARTTLS on 2525.
-
Add the provider’s SPF include, enable DKIM at the provider, and keep DMARC aligned.
-
Optional: if you ever must use 587, set a smarthost in WHM » Exim Configuration so mail goes out via Exim (still compatible with SMTP Restrictions).
Minimal PHPMailer example
$mail->isSMTP(); $mail->Host = 'smtp.your-relay.example'; // e.g. smtp2go.com or sendgrid.net $mail->Port = 2525; $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; $mail->SMTPAuth = true; $mail->Username = 'your_smtp_username'; // some providers use "apikey" $mail->Password = 'your_smtp_password_or_api_key'; $mail->setFrom('no-reply@yourdomain.com', 'Your App');We use this pattern in production (with a relay provider) and haven’t had issues.
If you want, I can share a quick SPF/DKIM template or a sample Exim smarthost config.1 -
-
Thanks everyone I'll give it go and see what happens.
0
Please sign in to leave a comment.
Comments
5 comments