You create an application to send a message by e-mail. An SMTP server is available on the local subnet. The SMTP server is named smtp.contoso.com. To test the application, you
use a source address, [email protected], and a target address, [email protected]. You need to transmit the e-mail message. Which code segment should you use?
A.
Dim MailFrom As New MailAddress(“[email protected]”, “Me”)Dim MailTo As New MailAddress(“[email protected]”, “You”)Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject = “Greetings”Message.Body = “Test”Message.Dispose()
B.
Dim SMTPClient As String = “smtp.contoso.com”Dim MailFrom As String = “[email protected]”Dim MailTo As String = “[email protected]”Dim Subject As String = “Greetings”Dim Body As String = “Test”Dim Message As New MailMessage(MailFrom, MailTo, Subject, SMTPClient)
C.
Dim MailFrom As New MailAddress(“[email protected]”, “Me”)Dim MailTo As New MailAddress(“[email protected]”, “You”)Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject = “Greetings”Message.Body = “Test”Dim objClient As New SmtpClient(“smtp.contoso.com”)objClient.Send(Message)
D.
Dim MailFrom As New MailAddress(“[email protected]”, “Me”)Dim MailTo As New MailAddress(“[email protected]”, “You”)Dim Message As New MailMessage(MailFrom, MailTo)Message.Subject = “Greetings”Message.Body = “Test”Dim Info As New SocketInformationDim Client As New Socket(Info)Dim Enc As New ASCIIEncodingDim Bytes() As Byte = Enc.GetBytes(Message.ToString)Client.Send(Bytes)