WebSmtpConnect Function

Action

Connects to an SMTP server.

Include file

WebAPI.bdh

Syntax

WebSmtpConnect( out hSmtp     : number,
                in  sHost     : string,
                in  nPort     : number,
                in  nSecurity : number optional ): boolean;

Return value

  • true if the connection could be established and the server sent a response message

  • false otherwise

Parameter Description
hSmtp

Variable receiving a handle to the Web connection

If this parameter contains a handle to a Web connection prior to the WebSmtpConnect function call, the memory allocated with the handle is released. Whenever you want to create a new Web connection, make sure this variable is initialized with 0 (this is automatically done within transactions when they are executed for the first time, but not within functions)

sHost Address of the SMTP server
nPort Port to connect at the SMTP server. The standard port is WEB_PORT_SMTP (25)
nSecurity

Specifies whether to establish a secure connection to the remote server (optional). Possible options are:

  • WEB_CONNECT_NONE. Establishes an insecure connection to the server (default)

  • WEB_CONNECT_SSL. Establishes a secure connection using SSL

Example

dcltrans
  transaction TWebSmtp
  var
    hSmtp: number;
  begin
    WebSmtpConnect(hSmtp, "standardhost", WEB_PORT_SMTP);
    WebSmtpHello(hSmtp, "<MyDomain>");
    WebSmtpQuit(hSmtp);
    WebSmtpShutdown(hSmtp);
  end TWebSmtp;

Sample scripts

WebMulti01.bdf

SilkEssential sample

eMail.sep