class SmtpServer
A data class representing an SMTP server configuration with a value and read-only flag, inheriting from ClientValue.
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/sharepoint/tenant/administration/smtp_server.py
4 - 11
simple
Purpose
SmtpServer is a simple data container class used to encapsulate SMTP server configuration information within the Office365 API client library. It stores the SMTP server address/value and whether this configuration is read-only. This class is part of the Office365 REST API client infrastructure for managing email server settings.
Source Code
class SmtpServer(ClientValue):
def __init__(self, value=None, is_readonly=None):
"""
:param str value:
:param bool is_readonly:
"""
self.Value = value
self.IsReadOnly = is_readonly
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
ClientValue | - |
Parameter Details
value: A string representing the SMTP server address or identifier. This could be a hostname, IP address, or server name. Can be None if not yet configured.
is_readonly: A boolean flag indicating whether this SMTP server configuration is read-only and cannot be modified. Can be None if the read-only status is not specified.
Return Value
Instantiation returns an SmtpServer object with Value and IsReadOnly attributes set according to the provided parameters. The object inherits from ClientValue, which likely provides serialization/deserialization capabilities for Office365 API communication.
Class Interface
Methods
__init__(self, value=None, is_readonly=None)
Purpose: Initializes a new SmtpServer instance with optional server value and read-only flag
Parameters:
value: Optional string representing the SMTP server address or identifieris_readonly: Optional boolean indicating if the configuration is read-only
Returns: None (constructor)
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
Value |
str or None | Stores the SMTP server address, hostname, or identifier | instance |
IsReadOnly |
bool or None | Indicates whether this SMTP server configuration is read-only and cannot be modified | instance |
Dependencies
office365
Required Imports
from office365.runtime.client_value import ClientValue
Usage Example
from office365.runtime.client_value import ClientValue
class SmtpServer(ClientValue):
def __init__(self, value=None, is_readonly=None):
self.Value = value
self.IsReadOnly = is_readonly
# Create a new SMTP server configuration
smtp_server = SmtpServer(value="smtp.office365.com", is_readonly=False)
# Access the server value
print(smtp_server.Value) # Output: smtp.office365.com
# Check if read-only
print(smtp_server.IsReadOnly) # Output: False
# Create with default values
default_smtp = SmtpServer()
print(default_smtp.Value) # Output: None
print(default_smtp.IsReadOnly) # Output: None
Best Practices
- This is a simple data container class with no methods beyond initialization
- The class uses PascalCase for attribute names (Value, IsReadOnly) following Office365 API conventions
- Both constructor parameters are optional and default to None, allowing flexible instantiation
- Instances should be treated as immutable if IsReadOnly is True
- This class is typically used as part of larger Office365 API operations and not standalone
- The parent class ClientValue likely provides JSON serialization for API communication
- When creating instances, ensure the value parameter contains a valid SMTP server address if being used for actual email operations
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class EmailAddress 58.9% similar
-
class AppProperties 54.7% similar
-
class EmailProperties 54.4% similar
-
class Recipient 54.0% similar
-
class SelfSignedCertificate 53.9% similar