Question: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, me@contoso.com, and a target address, you@contoso. com.
You need to transmit the e-mail message.
Which code segment should you use?
A Dim MailFrom As New MailAddress("me@contoso.com", "Me") Dim MailTo As New MailAddress ("you@contoso.com", "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)
B Dim MailFrom As New MailAddress("me@contoso.com", "Me") Dim MailTo As New MailAddress ("you@contoso.com", "You") Dim Message As New MailMessage(MailFrom, MailTo)
Message.Subject = "Greetings"
Message.Body = "Test"
Message.Dispose()
C Dim SMTPClient As String = "smtp.contoso.com"
Dim MailFrom As String = "me@contoso.com"
Dim MailTo As String = "you@contoso.com"
Dim Subject As String = "Greetings"
Dim Body As String = "Test"
Dim Message As New MailMessage(MailFrom, MailTo, Subject, SMTPClient)
D Dim MailFrom As New MailAddress("me@contoso.com", "Me") Dim MailTo As New MailAddress ("you@contoso.com", "You") Dim Message As New MailMessage(MailFrom, MailTo)
Message.Subject = "Greetings"
Message.Body = "Test"
Dim Info As New SocketInformation
Dim Client As New Socket(Info)
Dim Enc As New ASCIIEncoding
Dim Bytes() As Byte = Enc.GetBytes(Message.ToString) Client.Send(Bytes)