PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Properties specific to the description of emailSMTPSession variables
  • Functions that use the emailSMTPSession variables
  • Limits
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
The emailSMTPSession type is used to access a messaging server by using the SMTP protocol (Simple Mail Transfer Protocol) in order to send emails. The connection characteristics can be defined and modified by several WLanguage properties.
Notes:
  • See Declaring a variable for more details.
  • In most cases, the SMTP server to use is the SMTP server of Internet provider (and not the one of email account). For example, if you have Internet access via Orange and a Free email account, you must use the SMTP server of Orange (and not the one of Free). To use a different SMTP server, you must use an authenticated SMTP server, that requires a secure connection in most cases.
Versions 17 and later
iPhone/iPad This type of variable is now available for the iPhone and iPad applications.
New in version 17
iPhone/iPad This type of variable is now available for the iPhone and iPad applications.
iPhone/iPad This type of variable is now available for the iPhone and iPad applications.
Versions 21 and later
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
New in version 21
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Universal Windows 10 App This type of variable is now available in Universal Windows 10 App mode.
Versions 22 and later
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
New in version 22
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
Android Widget This type of variable is now available in Android Widget mode.
Android This type of variable is now available for the Android applications.
Example
WINDEVWEBDEV - Server code
// Start an SMTP session secured by TLS
MySession is EmailSMTPSession
MySession..ServerAddress = "smtp.mycompany.us"
MySession..Option = emailOptionSecuredTLS

// The TLS port depends on the provider, to be checked!
MySession..Port = 587

MySession..Name = "user"
MySession..Password = "secret"

// 10 seconds for the time-out
EmailSetTimeOut(10)

IF EmailStartSession(MySession) = False THEN
Error("Unable to start the SMTP session.", ErrorInfo(), ...
"In case of time-out, check the parameters of the " + ...
"""Firewall"" on the port used (" + ...
MySession..Port + ")")
RETURN
END

// Send a message
MyEmail is Email
...
EmailSendMessage(MySession, MyEmail)
...
EmailCloseSession(MySession)
Remarks

Properties specific to the description of emailSMTPSession variables

The following properties can be used to handle an emailSMTPSession variable:
Name Type used Effect
ServerAddressCharacter stringDNS name or IP address of email server (outgoing protocol). This address is supplied by the service provider or by the network administrator.
Caution: You must use the SMTP server of the provider of Internet connection. This SMTP server may have no link with the SMTP server associated with the email account.
AsynchronousBoolean or Integer constant
  • emailAsynchronous (or True) if the emails sent during the session started by EmailStartSMTPSession must be transmitted in asynchronous mode.
  • emailSynchronous (or False) otherwise (default value).
WINDEVLinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not available: the send operation is always performed in synchronous mode.
PasswordCharacter stringUser password. This password is given by the service provider or by the network administrator. This password is used to start an authenticated SMTP session.
NameCharacter stringUser name that will be used for the authenticated SMTP sessions.
OptionInteger constantOptions of SMTP connection. The possible values are:
  • emailOptionDefault (default value): Start an SMTP session.
  • emailOptionSecuredTLS: Start an SMTP session secured by the TLS protocol.
  • Versions 20 and later
    optionSSL: Start an SMTP session secured by the SSL protocol.
    New in version 20
    optionSSL: Start an SMTP session secured by the SSL protocol.
    optionSSL: Start an SMTP session secured by the SSL protocol.
LinuxAndroidAndroid Widget iPhone/iPadWindows MobileUniversal Windows 10 App This property is not supported.
Windows MobileUniversal Windows 10 App This property is not supported.
PortIntegerIdentifies the port used for the SMTP protocol (25 by default).

Note: These properties can be used via one of the following syntaxes:
  • <Variable Name>..<Property Name>
  • <Variable Name>.<Property Name>

Functions that use the emailSMTPSession variables

Versions 09 and later
EmailCloseSession
New in version 09
EmailCloseSession
EmailCloseSession
Closes a session for email management according to the selected mode (SMTP/POP3, IMAP, MS Exchange, Pocket Outlook or Lotus Notes).
Versions 09 and later
EmailSendMessage
New in version 09
EmailSendMessage
EmailSendMessage
Sends an email according to the protocol used (SMTP, MS Exchange, Pocket Outlook, Lotus Notes, Outlook).
Versions 09 and later
EmailStartSession
New in version 09
EmailStartSession
EmailStartSession
Starts a session for email management according to the selected management mode (POP3, SMTP, IMAP, MS Exchange or Pocket Outlook).
AndroidAndroid Widget

Limits

This type of variable is available for the devices equipped with ARM processors. A fatal error occurs if this type of variable is used with devices not equipped with ARM processors (x86, mips, ...). This type of variable is available for the devices equipped with ARM processors or using an ARM emulation. Otherwise (and on the Samsung Galaxy Tab 3 tablet), a fatal error will occur.
Related Examples:
WD Mail Complete examples (WINDEV): WD Mail
[ + ] This application is an email client developed in WINDEV. It is based on the Email objects.
This email client is used to retrieve and send emails by using the POP, IMAP and SMTP protocols.
You have the ability to apply filters to the incoming emails.

The application can also be used to manage several email accounts. The writing of an email is based on the HTML edit control.
Minimum required version
  • Version 15
This page is also available for…
Comments
Click [Add] to post a comment