[SQL Anywhere]

The xp_startsmtp procedure supports two parameters 'smtp_auth_username' and 'smtp_auth_password', which allow it to work with SMTP servers that require authentication.

I've been testing this against the free 'hMailServer' mail server and have found that the parameters do work but only if the server is set to 'Allow plain text authentication' (which it isn't by default).

Looking at the SMTP logs and doing some reading (e.g. here), I now understand that there are several different types of SMTP authentication around: LOGIN, PLAIN and CRAM-MD5 (and possibly others?). The default for hMailServer is simply LOGIN, which causes xp_startsmtp to return 104. Ticking the 'Allow plain text authentication' tickbox adds PLAIN support at which point xp_startsmtp returns success. I haven't found a way of enabling CRAM-MD5 with hmailserver so don't know whether this will work with xp_startsmtp.

Can anyone tell me which forms of SMTP authentication are supposed to be supported by SQL Anywhere?

For reference, the command I have been testing with is of the form:

DECLARE li_result integer;
li_result = CALL  xp_startsmtp( 
    smtp_sender = 'testsender@testdomain.co.uk'
    , smtp_server = ''
    , smtp_port = 25
    , timeout = 60
    , smtp_auth_username = 'test@testpc.testdomain.co.uk'
    , smtp_auth_password = 'test'
SELECT li_result;

asked 04 Mar '13, 05:27

Luke's gravatar image

accept rate: 40%

At the moment we only support PLAIN authentication. We are investigating adding other forms of authentication in future versions of SQL Anywhere.

permanent link

answered 04 Mar '13, 09:05

Graeme%20Perrow's gravatar image

Graeme Perrow
accept rate: 54%

Thanks for the answer.

(04 Mar '13, 09:11) Luke


please could you give me some informations about the availability of AUTH LOGIN ? maybe in SQL Anywhere 16.x ?

Kind regards


(13 Nov '13, 13:29) Frank_V
Replies hidden

Sorry, v16 only supports PLAIN authentication.

(13 Nov '13, 13:32) Graeme Perrow

Hello Graeme,

is it possible, to give me some ideas to solve this problem because we must ensure to send newsletter emails from db-side.

The mailserver authentication method AUTH LOGIN of the provider is fixed and cannot be changed !

Thx in advance


(15 Nov '13, 04:56) Frank_V
Replies hidden

There are a number of command line mail programs (eg Blat) available that you could use with xp_cmdshell()

(15 Nov '13, 05:07) Justin Willey

Hello Justin,

thx for your answer. Yes, you're right, but this would be my last possibilty - maybe there is a smarter solution.

best regards


(15 Nov '13, 05:32) Frank_V
Replies hidden

FWIW: Frank, I have just converted your postings from "answers" into comments, as I think they are not actual answers. You can do that yourself by using the "add new comment" button beneath each question/answer or by using the "reply" button (second symbol from right) beneath each comment (for nested comments).

(15 Nov '13, 05:39) Volker Barth

Okay and sorry for your inconvenience

Best regards


(15 Nov '13, 05:42) Frank_V
Replies hidden

No inconvenience, absolutely:)

(15 Nov '13, 06:21) Volker Barth

Hi Frank - unless someone from SAP is able to say otherwise, it's unlikely that new authentication types are going to be added to existing versions - new features tend to come with major version releases rather than ebfs (not always, but usually).

If that is the case, I think your possible workarounds are limited to using a mail server with will accept an authentication method compatible with what the SQL Anywhere server can do (which doesn't sound practicable for you), or using another method of sending the emails. However someone may have a cleverer idea!

(15 Nov '13, 06:46) Justin Willey
showing 5 of 10 show all flat view
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 04 Mar '13, 05:27

question was seen: 4,988 times

last updated: 17 Nov '13, 08:58