Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have written a stored procedure in MSSQL Server 2008 R2 which sends emails when my Application logs errors. It works fine on servers at our office but when I ran it on our remote servers I got

must issue a starttls command first

So maybe there is a setting somewhere which is different between the two servers, and that's why it's working on one and not the other. How do I set the server so that it issues a "starttls commaned first"?

share|improve this question
up vote 0 down vote accepted

I believe your "must issue a starttls command first" error message is coming from the mail server which you are transmitting your e-mail to. It may be set up to only accept encrypted connections for message transmissions. You could verify this by trying to telnet into the mail server and mimicking the SMTP protocol exchange which might look somewhat like this:

putty -telnet 25

> 220 Microsoft ESMTP MAIL Service ready at Wed, 29 Jun 2011 11:57:31 +0200
< helo test
> 500 5.3.3 Unrecognized command
< helo test
> 250 Hello []
< mail from:<>
> 250 2.1.0 Sender OK
< rcpt to:<>
> 250 2.1.5 Recipient OK
< data
> 354 Start mail input; end with <CRLF>.<CRLF>

In this example, lines beginning with ">" are mail server replies and lines beginning with "<" are what you need to type to get the replies. Replace with the mail server you are using. If you will see "must issue starttls first" anywhere in the exchange, then this is it.

If you are using the Database Mail configuration wizard of SQL Server 2008 to define your mail server account settings along with the sp_send_dbmail stored procedure to send the mail, you simply will need to make sure that the "this server requires a secure connection (SSL)" checkbox is checked in the account's properties.

share|improve this answer
thanks syneticon-dj! – David Jul 5 '11 at 1:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.