SQL Object
 
Syntax
 
SQL.SendInternetMail(ToAddress, Message[, Attachment][, SenderName][, Urgent][, Confirm][, Subject])
 
Description
Sends an e-mail message through the Tradium Mail Server over the Internet. If the message is successfully included in the sendqueue, the function returns TRUE, or FALSE otherwise.
 
The message can be plain text or HTML. There is no separate parameter for this: the Tradium Mail Server determines the format from the content of the message.
 

HTML messages

  •  •A message is sent as HTML when it contains the tag <html> (or <!DOCTYPE html>). Without this tag the message is sent as plain text, and tags such as <b> appear literally in the mail. Therefore always enclose an HTML message in <html><body> ... </body></html>.
  • Always specify the subject with the parameter Subject. In an HTML message a line 'Subject:' is not removed from the text, so the recipient would see it.
  • Refer to images with a full web address, for example <img src="https://www.mijnbedrijf.nl/logo.png">. The mail is composed by the Tradium Mail Server, so a local path such as C:\Afbeeldingen\logo.png refers to the computer on which the mail server runs, not to the computer of the user.
  • The message is stored and sent in the Windows-1252 character set. Accented characters and the euro sign are no problem. Characters outside this set, such as emoji, are lost; write them as a numeric HTML entity instead, for example &#128512;. Do not declare charset=utf-8 in the HTML, because the message itself is not UTF-8.
  • Keep the message, including the HTML code, under 400 KB (409,600 characters). A longer message is truncated. Images embedded in the HTML as a data: URI quickly exceed this limit.
  • Files from the parameter Attachment are added as normal attachments, both to plain text and to HTML messages.
 
 
Parameter
Description
ToAddress
A valid e-mail address. May also be multiple addresses separated by the semicolon sign (;).
note: CC and BCC addresses can also be added here, preceded by a CR/LF sign. See example
Message
Message content, as plain text or as HTML (see HTML messages above).
In a plain text message a header line such as 'Subject:' (or 'Onderwerp:' or 'Betreft:') can be included. That line is used as the subject and removed from the text.
Attachment
Optional. Attachment that should be included. If single file, then a string value with full path and file name of the attachment.
If multiple attachments, specify an Array of String type containing the path and file names.
SenderName
Optional. If entered, this name will be used as the sender in the mail. Example 'sales@mijnbedrijf.nl'. This ignores the part after the @ sign. TRADIUM only allows sender names from the internally registered domain name.
Urgent
Optional. If True then the message is assigned a high priority. Default value is False.
Confirm
Optional. If True then the message is accompanied by a read confirmation request. Default value is False.
Subject
Optional, alternative to the subject included in the message, such as 'Subject:'. If entered, the message itself is not searched for a subject.
Recommended for HTML messages.
 
See Also
Example
Sub Main()
 
    Dim sMsg As String, sFile As String
 
    sMsg = InputBox$("Bericht:")
    If Len(sMsg) = 0 Then End
 
    sMsg = "Subject: Test" & vbCrLf & sMsg
 
    sFile = GetFilePath()
 
    Debug.Print SQL.SentInternetMail("info@instalbase.com" & _
                                       vbCRLF & "myccadres@website.com" & _
                                       vbCRLF & "mybcc@website.com", sMsg, sFile)
 
End Sub

 
HTML message with an image, a sender name and a subject:
         
Sub Main()
 
Dim sAan As String, sOnderwerp As String, sHtml As String
 
sAan = "klant@voorbeeld.nl"
sOnderwerp = "Uw bestelling is verzonden"
 
sHtml = "<html><body>" & _
"<p>Beste klant,</p>" & _
"<p>Uw bestelling <b>12345</b> is vandaag verzonden.</p>" & _
"<p><img src=""https://www.mijnbedrijf.nl/logo.png"" alt=""logo""></p>" & _
"<p>Met vriendelijke groet,<br>Afdeling verkoop</p>" & _
"</body></html>"
 
'Attachment, Urgent en Confirm worden overgeslagen
If Not SQL.SendInternetMail(sAan, sHtml, , "verkoop", , , sOnderwerp) Then
MsgBox "Het bericht is niet in de verzendwachtrij geplaatst."
End If
 
End Sub