emailinvantive-sqlinvantive-data-hub

Sending mail via Office 365 smtp using Invantive SQL


I'm trying to send a e-mail using the Invantive Data Hub using the following query (password and username are redacted).

insert into smtp@Mail
( fromEmail
, toEmail
, subject
, body
, smtpHostAddress
, smtpUsername
, smtpPassword
)
VALUES
( "no_reply@XXX.com"
, "XXX@XX.com"
, "Test"
, "Body"
, "smtp.office365.com"
, "XXX@XXX.com"
, "*******"
)

This results in the following error:

Uitroep itgendhb077: Error in Invantive Data Hub.
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [DB6P191CA0024.EURP191.PROD.OUTLOOK.COM]

The username/password is correct (checked that), is there a way to trigger Invantive Data Hub to use a secure connection?

I have used the smtp syntax from this LinkedIn post.


Solution

  • Sending email from Invantive SQL can sometimes be hard. In your case, I would recommend one of the following solutions:

    The first one is a system administrator task; the use of secured transport can be enforced by specifying a value for the field enableSsl in smtp@mail.

    This field enableSsl has become available in July 2017 and later releases. The full list of fields is:

    More Mail Fields

    Please note that insert into smtp@mail has many more fields available, such as:

    insert into Smtp@Mail 
    (headers, fromEmail, fromName, replyToEmail, replyToName, toEmail, ccEmail, bccEmail, subject, body, isBodyHtml, priority, smtpHostAddress, smtpUsername, smtpPassword) 
    values 
    ( 'X-SAMPLE:Y;X-SAMPLE2:Z'
    , 'someone@somewhere'
    , 'Test'
    , 'me@home'
    , 'Test'
    , 'me@home'
    , ''
    , ''
    , 'Ubersicht Rechnungen (HTML) [s-unittest]'
    , '<p>Sehr geehrte Damen und Herren,</p>'
           || '<p>Um Ihnen unnötiges Nachhalten offener Rechnungen zu ersparen, informieren wir Sie mit diesem Schreiben über Ihr Konto bei ACME.</p>'
           || '<p>Wir wünschen Ihnen viel Erfolg bei Ihren Geschäften.</p>'
           || ' <p>Mit freundlichen Grüßen,</p>'
           || ' <p><b>Invantive GmbH</b></p>'
    , 'true'
    , -1
    , 'smtp.server.address'
    , 'some-user'
    , 'some-password'
    )
    

    For instance, to include an attachment use the fields attachmentContents, attachmentName and attachmentMimeType. A full list of fields you get by querying either systemtablecolumns@datadictionary or pressing F4 in the query tool when the cursor is located on the smtp@mail text.

    Defaults

    You don't have to specify all values on your insert into smtp@mail. There are a number of options for which you can set defaults from your settings.xml connection string or through the set statement.

    The available options can be using a query like select * from systemdatacontainerattributes@datadictionary or on systemproviderattributes: