title: Plesk/MailEnable SMTP Relay Error
body: <p>I am having issues relaying SMTP emails to remote domains in MailEnable, and need some assistance identifying what exactly I am missing in the server setup.</p>
  
  <p>My setup was actually working fine until yesterday when I added an SPF record to the DNS setup of the server.  Then starting last night (the next time the system tried to send automated emails), the emails to remote addresses began failing.  From what I can tell, I am authenticating on the inbound portion of the SMTP call, but when it tries to connect outbound to send the message to the other server it acts like I have not authenticated.</p>
  
  <p>Background:  This is my own server, leased from a hosting company.  I have access to all settings for the site in IIS/Plesk/MailEnable.  Every time my custom-written VB.NET application tries to send an email to another address on my own domain, it works fine.  Every time my app tries to send the same email to an address on a remote domain, I receive an email back from POSTMASTER@mydomain.com with the following:</p>
  
  <pre><code>MailEnable: Message could not be delivered to some recipients.
  The following recipient(s) could not be reached:
  
      Recipient: [SMTP:user@otherdomain.com]
      Reason: 551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail.
  </code></pre>
  
  <p>I have a simple VB.NET test program I have written to try to debug this:</p>
  
  <pre><code>    Dim replyTo As New System.Net.Mail.MailAddress("no-reply@mydomain.com", "MyUser")
      Dim subject As String = "Test subject"
      Dim SendTo As String = "user@otherdomain.com"
      Dim body As String = "This is the email."
  
      Dim message As New System.Net.Mail.MailMessage
      message.From = New System.Net.Mail.MailAddress("no-reply@mydomain.com", "MyUser")
      message.ReplyToList.Add(replyTo)
      message.BodyEncoding = System.Text.Encoding.ASCII
      message.IsBodyHtml = True
      message.Subject = subject
      message.Bcc.Add("mydomainBCC@mydomain.com")
      message.Body = body
  
      Dim smtp As New System.Net.Mail.SmtpClient("mydomain.com")
      Dim smtpCredential As System.Net.NetworkCredential = New System.Net.NetworkCredential("no-reply@mydomain.com", "password")
      smtp.UseDefaultCredentials = False
      smtp.Credentials = smtpCredential
      smtp.Port = 587
      smtp.Send(message)
  </code></pre>
  
  <p>In MailEnable, I have:</p>
  
  <ul>
  <li>Activated port 587 and checked the box requiring authentication
  before allowing the submission through the port. Again, the above
  program works (through port 587) when I send to an address
  @mydomain.com, but still fails for anything sent to @otherdomain.com.</li>
  <li>Under the Relay tab, added entries in the "Allow relay for privileged
  IP ranges" option for each of 127.0.0.1, the internal network IP<br>
  address of the server, and the external IP address of the server. (Option to allow relay for Authenticated Users was already checked and is still checked)</li>
  </ul>
  
  <p>For completeness, here is the SPF record that was set up in the DNS yesterday:</p>
  
  <pre><code>v=spf1 a mx ipv4:75.XX.XX.XX include:_spf.google.com -all
  </code></pre>
  
  <p>MailEnable also created a file on the root drive of the server called SMTP-IN-TOP.TXT that logs the top count of authentications that come in, and I see all of my attempted counted in this file:</p>
  
  <pre><code>Recent Top Users    Authentications During Previous Hour
  no-reply@mydomain.com   4
  </code></pre>
  
  <p>And finally, here are the activity and debug logs from MailEnable showing one of the transaction attempts:</p>
  
  <p>Activity:</p>
  
  <pre><code>09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX         220 mydomain.com ESMTP MailEnable Service, Version: 7.0-- ready at 09/01/13 15:07:26    0   0   
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX EHLO    EHLO mydomain-web-01    250-mydomain.com [75.XX.XX.XX], this server offers 4 extensions 127 21  
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX AUTH    {blank} 334 UGFzc3dvcmQ6    18  41  no-reply@mydomain.com
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX AUTH    d29iVFY=    235 Authenticated   19  10  no-reply@mydomain.com
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX MAIL    MAIL FROM:&lt;no-reply@mydomain.com&gt;   250 Requested mail action okay, completed   43  34  no-reply@mydomain.com
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX RCPT    RCPT TO:&lt;adam.taylor@otherdomain.com&gt;   250 Requested mail action okay, completed   43  36  no-reply@mydomain.com
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX RCPT    RCPT TO:&lt;mydomainBCC@mydomain.com&gt;  250 Requested mail action okay, completed   43  34  no-reply@mydomain.com
  09/01/13 15:07:26   SMTP-IN 5300BA9154CC413AAD202DE4FBA6CB71.MAI    596 75.XX.XX.XX DATA    DATA    354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;    46  6   no-reply@mydomain.com
  09/01/13 15:07:27   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    780 50.XX.XX.XX CONN        220 recipientserver.com ESMTP MailEnable Service, Version: 6.53-- ready at 09/01/13 15:07:26    0   86  
  09/01/13 15:07:27   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    780 50.XX.XX.XX EHLO    EHLO mydomain.com   250-recipientserver.com [75.XX.XX.XX], this server offers 4 extensions  18  127 
  09/01/13 15:07:27   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    780 50.XX.XX.XX MAIL    MAIL FROM:&lt;no-reply@mydomain.com&gt; SIZE=423  551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail. 43  169 
  09/01/13 15:07:27   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    780 50.XX.XX.XX QUIT    QUIT    221 Service closing transmission channel    6   42  
  09/01/13 15:07:28   SMTP-IN 8E182A43292745538949A1160E407982.MAI    780 127.0.0.1           220 mydomain.com ESMTP MailEnable Service, Version: 7.0-- ready at 09/01/13 15:07:28    0   0   
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   CONN        220 mydomain.com ESMTP MailEnable Service, Version: 7.0-- ready at 09/01/13 15:07:28    0   85  
  09/01/13 15:07:28   SMTP-IN 8E182A43292745538949A1160E407982.MAI    780 127.0.0.1   EHLO    EHLO mydomain.com   250-mydomain.com [127.0.0.1], this server offers 4 extensions   123 18  
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   EHLO    EHLO mydomain.com   250-mydomain.com [127.0.0.1], this server offers 4 extensions   18  123 
  09/01/13 15:07:28   SMTP-IN 8E182A43292745538949A1160E407982.MAI    780 127.0.0.1   MAIL    MAIL FROM:&lt;&gt; SIZE=1052  250 Requested mail action okay, completed   43  24  
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   MAIL    MAIL FROM:&lt;&gt; SIZE=1052  250 Requested mail action okay, completed   24  43  
  09/01/13 15:07:28   SMTP-IN 8E182A43292745538949A1160E407982.MAI    780 127.0.0.1   RCPT    RCPT TO:&lt;no-reply@mydomain.com&gt; 250 Requested mail action okay, completed   43  32  
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   RCPT    RCPT TO:&lt;no-reply@mydomain.com&gt; 250 Requested mail action okay, completed   32  43  
  09/01/13 15:07:28   SMTP-IN 8E182A43292745538949A1160E407982.MAI    780 127.0.0.1   DATA    DATA    354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;    46  6   
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   DATA    DATA    354 Start mail input; end with &lt;CRLF&gt;.&lt;CRLF&gt;    6   46  
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   DATE        250 Requested mail action okay, completed   1063    43  
  09/01/13 15:07:28   SMTP-IN 05D1026706304C7F941CD6348057CC71.MAI    780 127.0.0.1   QUIT    QUIT    221 Service closing transmission channel    42  6   
  09/01/13 15:07:28   SMTP-OU D65C7059FE274FBCBA296953ABA4221F.MAI    576 127.0.0.1   QUIT    QUIT    221 Service closing transmission channel    6   42  
  </code></pre>
  
  <p>Debug:</p>
  
  <pre><code>09/01/13 15:07:26   ME-I0135: Authenticating User:no-reply@mydomain.com using Authentication Provider Credentials
  09/01/13 15:07:26   ME-I0107: [596] Relay Granted: Sender IP (75.xx.xx.xx) is within an authorized IP range.
  09/01/13 15:07:26   ME-I0101: [596] Local Delivery: Address ([SMTP:mydomainBCC@mydomain.com]) is local.
  09/01/13 15:07:26   ME-I0149: [596] 5300BA9154CC413AAD202DE4FBA6CB71.MAI was received successfully and delivery thread was initiated
  09/01/13 15:07:26   ME-E0070: (recv) socket [596] error during [DATA] command from host 75.xx.xx.xx. Socket was disconnected - Error: (10054)
  09/01/13 15:07:26   ME-I0074: [596] (Debug) End of conversation
  09/01/13 15:07:27   ME-I0018: [2B8847ABCC1242EDBF3417D32DA6DB59.MAI] Outbound message from ([SMTP:no-reply@mydomain.com]) requeued as [D65C7059FE274FBCBA296953ABA4221F.MAI] to the target domain [otherdomain.com]
  09/01/13 15:07:27   ME-I0123: Domain [otherdomain.com] has MX list [mail.otherdomain.com]
  09/01/13 15:07:27   ME-I0026: [D65C7059FE274FBCBA296953ABA4221F.MAI] Sending message
  09/01/13 15:07:27   ME-IXXXX: [D65C7059FE274FBCBA296953ABA4221F.MAI] DNS resolved to the following record: IP Address=50.XX.XX.XX, Family=2, Type=1, Protocol=6
  09/01/13 15:07:27   ME-IXXXX: [D65C7059FE274FBCBA296953ABA4221F.MAI] Remote server returned a response indicating a permanent error. Server Response: (551 This mail server requires authentication before sending mail from a locally hosted domain. Please reconfigure your mail client to authenticate before sending mail.**)
  09/01/13 15:07:27   ME-E0036: [D65C7059FE274FBCBA296953ABA4221F.MAI] MAIL FROM command Failed.
  09/01/13 15:07:27   ME-E0008: [D65C7059FE274FBCBA296953ABA4221F.MAI] Outbound, could not send the command to the server (error 10038).
  09/01/13 15:07:27   ME-E0060: [D65C7059FE274FBCBA296953ABA4221F.MAI] - Message could not be delivered to target domain (otherdomain.com). Message returned to Sender.
  09/01/13 15:07:28   ME-I0119: Domain [mydomain.com] has used local loopback address [127.0.0.1] because it is hosted locally.
  09/01/13 15:07:28   ME-I0026: [D65C7059FE274FBCBA296953ABA4221F.MAI] Sending message
  09/01/13 15:07:28   ME-IXXXX: [D65C7059FE274FBCBA296953ABA4221F.MAI] DNS resolved to the following record: IP Address=127.0.0.1, Family=2, Type=1, Protocol=0
  09/01/13 15:07:28   ME-I0101: [780] Local Delivery: Address ([SMTP:no-reply@mydomain.com]) is local.
  09/01/13 15:07:28   ME-I0149: [780] 8E182A43292745538949A1160E407982.MAI was received successfully and delivery thread was initiated
  09/01/13 15:07:28   ME-I0049: [D65C7059FE274FBCBA296953ABA4221F.MAI] Send Completed Successfully
  09/01/13 15:07:28   ME-I0074: [780] (Debug) End of conversation
  </code></pre>