cancel
Showing results for 
Search instead for 
Did you mean: 

How do I solve xp_startsmtp return code 105 when using gmail?

Breck_Carter
Participant
3,680

I'm not having any luck following Eric Farrar's instructions for using xp_startsmtp with gmail.

Return code 105 means "A TLS error occurred" ( like I didn't know that already :)...

I'm using Norton Internet Security, tried turning it off but no joy.

xp_startsmtp @return_code = 105
xp_sendmail @return_code = 25
BEGIN
DECLARE @return_code           INTEGER;
DECLARE @smtp_sender           LONG VARCHAR;
DECLARE @smtp_server           LONG VARCHAR; 
DECLARE @smtp_port             INTEGER; 
DECLARE @timeout               INTEGER;
DECLARE @smtp_sender_name      LONG VARCHAR;
DECLARE @smtp_auth_username    LONG VARCHAR; 
DECLARE @smtp_auth_password    LONG VARCHAR;
DECLARE @trusted_certificates  LONG VARCHAR;
DECLARE @recipient             LONG VARCHAR;
DECLARE @subject               LONG VARCHAR;
DECLARE @message               LONG VARCHAR;

SET @smtp_sender          = 'Breck.Carter@gmail.com'; -- full email address for gmail
SET @smtp_server          = 'smtp.gmail.com';  -- smtp.gmail.com for gmail
SET @smtp_port            = 587;  -- 25 for standard SMTP, 465 or 587 for gmail
SET @timeout              = 10;   -- default is 60 seconds
SET @smtp_sender_name     = 'Foxhound';
SET @smtp_auth_username   = 'Breck.Carter@gmail.com'; -- full email address for gmail
SET @smtp_auth_password   = '...';
SET @trusted_certificates = 'C:\\TEMP\\Thawte Premium Server CA.cer';
SET @recipient            = 'bcarter@bcarter.com';
SET @subject              = STRING ( 'test subject at ', CURRENT TIMESTAMP );
SET @message              = STRING ( 'test message at ', CURRENT TIMESTAMP );

@return_code = CALL xp_startsmtp ( 
   smtp_sender          = @smtp_sender,  
   smtp_server          = @smtp_server,  
   smtp_port            = @smtp_port,  
   timeout              = @timeout,
   smtp_sender_name     = @smtp_sender_name,
   smtp_auth_username   = @smtp_auth_username, 
   smtp_auth_password   = @smtp_auth_password,
   trusted_certificates = @trusted_certificates );

MESSAGE STRING ( 'xp_startsmtp @return_code = ', @return_code ) TO CLIENT;

@return_code = CALL xp_sendmail ( 
   recipient  = @recipient,  
   subject    = @subject,  
   "message"  = @message );

MESSAGE STRING ( 'xp_sendmail @return_code = ', @return_code ) TO CLIENT;

CALL xp_stopsmtp(); -- do not bother to check return code

EXCEPTION WHEN OTHERS THEN
   CALL xp_stopsmtp();

END;

Accepted Solutions (1)

Accepted Solutions (1)

MarkCulp
Participant

Google recently (not sure when exactly) changed the certificate that is used by their gmail service. They now use a certificate from Equifax.

You should likely download the certificate directly from Equifax (or Google) but I have attached one that works (as of this date of this posting) to get you going.

I guess Eric should update his blog entry? (I'll mention this to him)

Answers (0)