Constructor
new SmtpServer(address, port, username, password, sslEnabled)
Default constructor.
Parameters:
Name | Type | Description |
---|---|---|
address |
string | SMTP server address. |
port |
number | SMTP server TCP port. |
username |
string | Username to access the SMTP server. Can be left null or blank. |
password |
string | Password to access the SMTP server. Can be left null or blank. |
sslEnabled |
string | True if SSL protocol should be used for authentication. |
Throws:
-
If an invalid parameter is given.
- Type
- SyntaxError
Methods
getAddress() → {string}
Returns:
Server address.
- Type
- string
getPassword() → {string}
Returns:
Password used to authenticate on SMTP server.
- Type
- string
getPort() → {number}
Returns:
Server TCP port.
- Type
- number
getUsername() → {string}
Returns:
Username used to authenticate on SMTP server.
- Type
- string
isSslEnabled() → {boolean}
Returns:
True if SSL is enabled, false otherwise.
- Type
- boolean
setAddress(address)
Update the address of the SMTP server.
Parameters:
Name | Type | Description |
---|---|---|
address |
string | New address. |
Throws:
-
In case of invalid parameter.
- Type
- SyntaxError
setPassword(password)
Update the password used to authenticate on SMTP server.
Parameters:
Name | Type | Description |
---|---|---|
password |
string | New password (null is equivalent to empty). |
setPort(port)
Update the TCP port number used by the SMTP server.
Parameters:
Name | Type | Description |
---|---|---|
port |
number | New port number; |
Throws:
-
In case of invalid parameter.
- Type
- SyntaxError
setSslEnabled(sslEnabled)
Update the SSL protocol state.
Parameters:
Name | Type | Description |
---|---|---|
sslEnabled |
boolean | If true, SSL protocol will be enabled. If false, it will be disabled. |
setUsername(username)
Update the username used to authenticate on SMTP server.
Parameters:
Name | Type | Description |
---|---|---|
username |
string | New username. |
Throws:
-
In case of invalid parameter.
- Type
- SyntaxError