|   | 
      
        
          
            
              | BOOL GetExtendedOptions( | 
             
            
              |   | 
              LPDWORD lpdwOptions | 
                | 
             
            
              | ); | 
             
           
         
        
          The GetExtendedOptions method returns the extended server
          options for the current session. 
         
        Parameters
        
          
            - lpdwOptions
 
            - Address of a variable that will be set to the current server
            options. This bitmask is created by combining one or more of the
            following values with a bitwise Or operator:
 
           
         
        
          
            
              
                | Constant | 
                Description | 
               
              
                | SMTP_EXTOPT_EXPN | 
                The server supports address expansion using the EXPN
                command. The ExpandAddress method can be used to
                expand addresses, which typically returns the email addresses 
                associated with a mailing list. Most public mail servers 
                restrict or disable this functionality because it can present a 
                security risk. If a server does permit the use of the command, 
                it is often limited to specific authorized users. | 
               
              
                | SMTP_EXTOPT_VRFY | 
                The server supports verification of addresses using the
                VRFY command. The VerifyAddress method can be used
                to verify addresses. Most public mail servers restrict the 
                ability for clients to verify email addresses to prevent 
                potential abuse. If a server does permit the use of the command, 
                it is often limited to specific authorized users. | 
               
              
                | SMTP_EXTOPT_DSN | 
                The server supports delivery status notification (DSN)
                which allows the sender to be notified when a message has been
                delivered, or when an error occurs during the delivery process.
                The SetDeliveryOptions method can be used to
                specify the delivery options to be used in the current
                session. | 
               
              
                | SMTP_EXTOPT_SIZE | 
                The server supports the use of the SIZE parameter, which
                enables the client to determine the maximum message size that
                may be delivered through the server. Most public mail servers 
                impose a limit of on the total size of a message, including any 
                encoded attachments. | 
               
              
                | SMTP_EXTOPT_ETRN | 
                The server supports the use of the ETRN command, instructing 
                the server to start processing its message queues for a specific 
                host. Most public mail servers do not support this capability 
                and its use has been deprecated. | 
               
              
                | SMTP_EXTOPT_8BITMIME | 
                The server supports the delivery of messages that contain
                characters with the high bit set. Most servers support this 
                option, however it is recommended that you encode any message 
                text which contains non-ASCII characters to ensure the broadest 
                compatibility with other servers and clients.  | 
               
              
                | SMTP_EXTOPT_STARTTLS | 
                The server supports explicit TLS sessions. This extended 
                option is used internally to determine how secure connections 
                should be established, and if a secure connection can be made 
                using the standard submission port. | 
               
              
                | SMTP_EXTOPT_UTF8 | 
                The server supports UTF-8 encoding in email addresses and 
                the message envelope. Not all mail servers will have this 
                extended capability enabled, and applications should not depend 
                on being able to provide internationalized user and domain names 
                unless this option bitflag has been set. | 
               
               
           
         
        
          
            In addition, there are extended options which specify the
            authentication methods supported by the server. A server
            will typically support multiple authentication methods and may
            be one or more of the following values: 
           
         
        
          
            
              
                | Constant | 
                Description | 
               
              
                | SMTP_EXTOPT_AUTHLOGIN | 
                The server supports client authentication using the AUTH 
                LOGIN command. This is 
                the default authentication method and is supported by most mail 
                servers. The user name and password are encoded in a specific 
                format, but are not encrypted. The client should use a secure 
                connection whenever possible. | 
               
              
                | SMTP_EXTOPT_AUTHPLAIN | 
                The server supports client authentication using the AUTH 
                PLAIN command. The use name and password are encoded in a 
                specific format, but are not encrypted. If a server supports 
                this authentication method, it is very likely it also supports 
                AUTH LOGIN. It is recommended you use only use AUTH PLAIN 
                authentication if the server does not support AUTH LOGIN. | 
               
              
                | SMTP_EXTOPT_XOAUTH2 | 
                The server supports client authentication using AUTH XOAUTH2 
                command. Instead of a password, an OAuth 2.0 bearer token is used 
                to authenticate the user which previously authorized access to 
                the mail server using their account information. The connection 
                must be secure to use this authentication method. | 
               
              
                | SMTP_EXTOPT_BEARER | 
                The server supports client authentication using AUTH 
                OAUTHBEARER command as specified in RFC 7628. Instead of a 
                password, an OAuth 2.0 bearer token is used to authenticate the 
                user which previously authorized access to the mail server using 
                their account information. The connection must be secure to use 
                this authentication method. The connection must be secure to use 
                this authentication method. | 
               
             
           
         
        
        Return Value
        
          If the method succeeds, the return value is a non-zero value. If
          the method fails, the return value is zero. To get extended error
          information, call GetLastError. 
         
        Remarks
        
          The GetExtendedOptions method returns the extended options
          supported by the server. The use of extended options requires that
          the server support the ESMTP protocol, and that the client connect
          using the SMTP_OPTION_EXTENDED option. 
          You should check these options prior to calling Authenticate
          to determine which authentication methods are acceptable to the
          server. If you wish to use an OAuth 2.0 bearer token, always check to make
          sure either the SMTP_EXTOPT_XOAUTH2 or SMTP_EXTOPT_BEARER bitflags
          are set in the options value returned by this method. 
         
        Example
        
          
BOOL bExtended = FALSE;
DWORD dwOptions = 0;
bExtended = pClient->GetExtendedOptions(&dwOptions);
if (bExtended && (dwOptions & SMTP_EXTOPT_XOAUTH2))
{
    INT nResult = pClient->Authenticate(lpszUserName, lpszBearerToken, SMTP_AUTH_XOAUTH2);
    if (nResult == SMTP_ERROR)
    {
        
        return;
    }
}
else
{
    
    return;
}
         
        Requirements
        
          Minimum Desktop Platform: Windows 7 (Service Pack 1)
           
          Minimum Server Platform: Windows Server 2008 R2 (Service Pack 1)
           
          Header File: cstools10.h
           
          Import Library: csmtpv10.lib 
         
        See Also
        
          
            Authenticate, 
            Connect, 
            GetDeliveryOptions, 
            SetDeliveryOptions
           
         
       | 
        |