1. Home
  2. Email
  3. Mail sent via rejects with “Relaying Denied”

Mail sent via rejects with “Relaying Denied”


Email that is sent over TCP via or the server IP address is rejected with a “521: Relaying Denied” error message.


All email that passes through TCP must be authenticated with a SASL-compatible username and password, which is the login/password used to access email on the server.


SASL authentication is necessary to track abuse and prevent unauthenticated users from relaying mail over TCP that the SMTP service cannot trace the initiating UID. Mail that passes through sendmail, for example through the PHP mail() command, do not carry this requirement as the UID and originating script are logged.

Authentication Settings


$mail = new PHPMailer;

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = '';                            // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'user@example.com';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to


Use WP SMTP Mail or continue to use WordPress’ built-in mailer without incident.

Ruby on Rails

via config/environments/$RAILS_ENV.rb:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:              '',
  port:                 587,
  domain:               'example.com',
  user_name:            'user@example.com',
  password:             'secret',
  authentication:       'plain',
  enable_starttls_auto: true}

See also


Updated on July 8, 2019

Was this article helpful?

Related Articles

Need Support?
Can’t find the answer you’re looking for? Don’t worry we’re here to help! If you get an error, visit https://lithiumhosting.com/support instead.
Contact Support