|
BOOL EnableRelay( |
|
LPCTSTR lpszHostName, |
|
|
UINT nHostPort, |
|
|
LPCTSTR lpszUserName, |
|
|
LPCTSTR lpszPassword, |
|
|
DWORD dwOptions, |
|
); |
BOOL EnableRelay( |
|
LPCTSTR lpszHostName, |
|
|
UINT nHostPort, |
|
); |
The EnableRelay method enables the relaying of messages
through another mail server.
Parameters
- lpszHostName
- A pointer to a string that specifies the
hostname or IP address of the mail server that the messages will be
relayed through. If this parameter is NULL or an empty string, then
message relaying will be disabled.
- nHostPort
- An integer value that specifies the port number that should be
used to establish the connection with the mail server. If this value
is zero, then the default SMTP port will be used.
- lpszUserName
- A pointer to a string that specifies the user
name that will be used to authenticate the session with the mail
server. If the server does not require authentication, this
parameter can be NULL or an empty string.
- lpszPassword
- A pointer to a string that specifies the
password that will be used to authenticate the session with the mail
server. If the server does not require authentication, this
parameter can be NULL or an empty string.
- dwOptions
- An integer value which specifies one or more options.
Value |
Description |
SMS_OPTION_NONE |
No additional options specified. This is the default value. |
SMS_OPTION_SECURE |
This option specifies that TLS will be used to establish
a secure, encrypted connection with the mail server. For some
servers, it may be required to connect to them securely and this
option will be enabled automatically. |
Return Value
If the method succeeds and relaying is enabled, the return value is
non-zero. If the method fails, the return value is zero. To get extended
error information, call GetLastError.
Remarks
When a text message is sent using the SMTP service, the default
action is to attempt to connect directly to the wireless service
provider's gateway server. However, many residential Internet service
providers (ISPs) do not permit their customers to connect to
third-party mail servers and will block the outbound connection. Some
wireless service providers may also reject messages that originate
from residential IP addresses.
To resolve this issue, the developer should allow the user to
specify an alternate mail server that will relay the message to the
wireless service provider. For residential users, this will typically
be the mail server provided by their ISP. For business users, this
will usually be their corporate mail server. The EnableRelay
method is used to specify the connection information for the mail
server and the SendMessage method will relay messages through
that server.
Calling the EnableRelay method without any arguments will
enable relaying through the mail server specified by a previous call
to the method. The EnableRelay method must be called at least
once with arguments to enable relaying. To temporarily disable
relaying, call the DisableRelay method.
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cstxtv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
DisableRelay,
IsRelaying,
SendMessage
|
|