GMail - Must issue a STARTTLS command first

sraitkensraitken Posts: 7 Bronze 1
edited October 24, 2014 3:56PM in SQL Backup Previous Versions
I am getting a "5.7.0 Must issue a STARTTLS command first..." error message popping-up when trying to send a test email via GMail. Settings are:

SMTP host: smtp.gmail.com
Port: 587
UserName: <email address>
Password: <password for above>
Send From: <same as email address in UserName>

Thanks for any help.

Comments

  • peteypetey Posts: 2,358 New member
    SQL Backup's e-mail delivery feature does not support TLS/SSL connections.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • spthornspthorn Posts: 12 Bronze 4
    Is this still the case? v7.7.0.18

    Will it ever be the case? Our email is provided by Amazon SES, which requires it.
  • peteypetey Posts: 2,358 New member
    There is a patch available that allows you to send mail via TLS and SSL. Details of the patch and required configuration can be found in this document:

    ftp://support.red-gate.com/patches/sql_ ... _patch.pdf
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • spthornspthorn Posts: 12 Bronze 4
    Peter, I installed the patch files per your attached procedure. Still not getting emails.
    SMTP Host: email-smtp.us-east-1.amazonaws.com
    Results are the same regardless of SMTPEncoding value in registry (TLS, SSH or blank). Doesn't appear to be any change from before.
    I tried the following ports (based on http://docs.aws.amazon.com/ses/latest/D ... nnect.html):
    Port Result
    465 Screen freezes, after 20 seconds or so it comes back, but no email received
    2465 Screen freezes, after 20 seconds or so I get error "Socket Error # 10060 Connection timed out."
    25 Screen freezes, after 20 seconds or so I get error "Socket Error # 10060 Connection timed out."
    587 Get error "Must issue a STARTTLS command first"
    2587 Screen freezes, after 20 seconds or so I get error "Socket Error # 10060 Connection timed out."

    I don't doubt that it works with Gmail and Yahoo mail. Nobody else is using Amazon SES (Simple Email Service) with SQL Backup Pro?
  • peteypetey Posts: 2,358 New member
    Were you using the SQL Backup GUI to test the sending of emails?
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • spthornspthorn Posts: 12 Bronze 4
    Yep, the Send Test Email button.
  • peteypetey Posts: 2,358 New member
    Could you please try configuring the email server settings as per the document referenced earlier for GMail (TLS, port 587 etc), and run a test backup using SSMS that sends an email e.g.
    EXEC master..sqlbackup '-sql "BACKUP DATABASE model TO DISK = &#91;&lt;AUTO&gt;&#93; WITH MAILTO = &#91;&lt;your email address here&gt;&#93;, MAILLIB_SYN"'
    

    Does the email get sent successfully?
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • spthornspthorn Posts: 12 Bronze 4
    Yes, it did generate the email just fine.

    I went ahead and added email notification to one of my half-hourly transaction log backup jobs, just to see if that email would fail as well... and it did. Generated a SQL Backup warning "Warning 151: MAILTO error: Failed to send mail. (Must issue a STARTTLS command first)".
  • peteypetey Posts: 2,358 New member
    In the job you modified, did you add the MAILLIB_SYN switch e.g.

    EXEC master..sqlbackup '-sql "BACKUP DATABASE model TO DISK = [<AUTO>] WITH MAILTO = [me@me.com], MAILLIB_SYN"'
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • spthornspthorn Posts: 12 Bronze 4
    Ok, Peter, I added that switch to the job via SSMS, and got the email generated as expected.

    However, when I attempt to edit the job in SQLBackup, I get the error "Cannot Edit Job <snip> Unknown option: MAILLIB_SYN".

    Overall, though, I'm happy I'm getting emails, and can deal with manual edits. Thanks so much for your help!
  • peteypetey Posts: 2,358 New member
    Glad to hear you've got it working.

    The patch was made only in the SQL Backup engine. The GUI hasn't been patched to recognise the new keyword yet, hence why it's raising that error.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • peteypetey Posts: 2,358 New member
    An improved patch (7.7.0.103) is now available, details of which can be found in this document

    ftp://support.red-gate.com/patches/sql_ ... _patch.pdf

    In this patch, you no longer need to use the MAILLIB_SYN switch. This allows you to test the configuration of your SSL/TLS server via the GUI, and you also do not need to reconfigure existing jobs to use that switch, which in turn stops the GUI from raising an 'unrecognized option' error.
    Peter Yeoh
    SQL Backup Consultant Developer
    Associate, Yohz Software
    Beyond compression - SQL Backup goodies under the hood, updated for version 8
  • spthornspthorn Posts: 12 Bronze 4
    Super, Peter. Works great! Thanks to the redgate team for this patch!
Sign In or Register to comment.