Skip to main content

SMTP Restrictions and External SMTP providers

Comments

5 comments

  • cPRex Jurassic Moderator

    Hey hey!  Probably - does your form authenticate to any specific account on the server?

    0
  • quietFinn

    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
  • cPRex Jurassic Moderator

    That's a good point - since the port is customized the SMTP Restrictions may not apply here at all!

    0
  • Rubfy

    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
  • HappyFeat

    Thanks everyone I'll give it go and see what happens.

    0

Please sign in to leave a comment.