Hunny Software Library Reference

SmtpClient.SendLines Method 

Sends the message as text lines.

[Visual Basic]
Public Function SendLines( _
   ByVal bytes As Byte(), _
   ByVal length As Integer, _
   ByVal options As Integer _
) As Integer
[C#]
public int SendLines(
   byte[] bytes,
   int length,
   int options
);

Parameters

bytes
The buffer containing the bytes to send.
length
The number of bytes to send.
options
A bit map of options that affect the behavior of the method.

Remarks

The message follows the DATA command, if the DATA command succeeds. In SMTP, the message is sent as a series of lines, where each line ends with the CR LF characters. The bytes provided as an argument to the SendLines method should be in the required format -- that is, the buffers should contain lines of text. (Remember that non-text data is converted to text by base64 encoding as required by the MIME specification.)

To send the message, call the SendLines method as many times as you need to send all the bytes of the message. When you call SendLines to send the first buffer, you must set the SmtpClient.FIRST bit in the options argument. When you send the last buffer, you must set the SmtpClient.LAST bit in the options argument.

SendLines performs the conversion to CR LF end-of-line characters if you specify SmtpClient.CONVERT_EOL as one of the options. With the SmtpClient.CONVERT_EOL option set, conversions are performed as follows: LF --> CR LF, and CR LF --> CR LF. Therefore, with the SmtpClient.CONVERT_EOL option, you can safely submit text with LF end-of-line characters or with CR LF end-of-line characters.

The SmtpClient.LAST option is an indication to the library code to receive a response from the server. You should then check the reply code of the server's response, which is available as the ReplyCode property. A 250 reply code indicates success.

Exceptions

Exception TypeCondition
ExceptionIf a network or protocol error occurs.

See Also

SmtpClient Class | Hunny.Mail Namespace