Click or drag to resize

CrestronMailFunctionsSendMail(String, UInt16, Boolean, String, String, String, String, String, String, String, UInt16, String) Method

Programmatically sends an email message to the specified IP address on the specified port using the SMTP protocol over a secure connection using SSL. Requires firmware version 1.11.xxxx or higher on the control system.

Namespace: Crestron.SimplSharp
Assembly: SimplSharpHelperInterface (in SimplSharpHelperInterface.dll) Version: 2.21.121
Syntax
C#
public static CrestronMailFunctionsSendMailErrorCodes SendMail(
	string Server,
	ushort PortNumber,
	bool SecureConnection,
	string UserLogonName,
	string UserLogonPassword,
	string From,
	string To,
	string CC,
	string Subject,
	string Message,
	ushort NumberOfAttachments,
	string Attachments
)

Parameters

Server  String
Required. Specifies address of the mail server. It can either be an IP address in dot-decimal notation (ex: 192.168.16.3) or a name to be resolved with a DNS server (ex: mail.myisp.com). If a name is given, the control system must be configured with a DNS server (ADDDNS console command). Maximum field length: 40.
PortNumber  UInt16
Required. Specifies the port number used to send the email. Normal values are 25 for unsecure and 465 for secure connections
SecureConnection  Boolean
Required. Indicates whether an SSL connection should be used to send the email.
UserLogonName  String
Required. If the mail server requires authentication, UserLogonName indicates the user name of the sender for the mail server. An empty string indicates that authentication is not required. Only "clear text" authentication is implemented. "Clear text" refers to the authentication method used by the mail server. If the mail server requires a higher level authentication, mail can not be sent to the mail server. Maximum field length: 254.
UserLogonPassword  String
Required. If the mail server requires authentication, UserLogonPassword indicates the password of the sender for the mail server. An empty string indicates that authentication is not required. Only "clear text" authentication is implemented, used by the server. If the mail server requires a higher level authentication, mail can not be sent to the mail server. Maximum field length: 254.
From  String
Required. Specifies the e-mail address of the sender in the a@b.com format. Only one email address is allowed. Aliases or nicknames are not supported. This argument is mandatory. Maximum field length: 242.
To  String
Required. Specifies the e-mail address of the recipient(s) in the a@b.com format. Multiple recipients may be specified delimited with a ";". Maximum field length: 65535.
CC  String
Optional. An empty string indicates that there are no recipients. Specifies the e-mail address of the carbon copy recipient(s) in the a@b.com format. Multiple recipients may be specified delimited with a ";". Maximum field length: 65535.
Subject  String
Optional. Specifies the subject of the email message. An empty string indicates that there is no subject. Maximum field length: 989.
Message  String
Optional. Specifies the body of the email message. An empty string indicates an empty message. Maximum field length: 65535.
NumberOfAttachments  UInt16
Optional. Specifies the number of attachments to be sent. Zero (0) specifies that there are no attachments.
Attachments  String
Optional. An empty string indicates that no attachments are to be sent. Specifies the files to be attached. Multiple filenames may be specified, delimited by ';'. Max field length is 65534.

Return Value

CrestronMailFunctionsSendMailErrorCodes
SMTP_OK if successful. Otherwise, Email Return Error Code is returned. Negative return error codes indicate that no part of the email was sent. Positive return error codes indicate a failure, but the email was still sent. In the event of more than one failure, the return error code of the first failure is returned.

Version Information

.NET

Supported in: 6.0

.NET Compact Framework

Supported in: 3.5
See Also