SMTPSecureSocket in console App

I have a Desktop App that sends mails using SMTPSecureSocket, but when I copy my code to a Console App, the mail is not sent. There are no errors just no mail (MailSocket.LastErrorCode = 0). Must I do anything different from a desktop app?
This is my code:

Var mail As New EmailMessage

mail.FromAddress = "..."
mail.AddRecipient "..."
mail.Subject = "Test"
mail.BodyHTML = "..."
mail.Headers.AddHeader("X-Mailer","SMTP Test")

var MailSocket as new SMTPSecureSocket

MailSocket.Address = "..."
MailSocket.Port = 25
MailSocket.Username = "..."
MailSocket.Password = "..."
MailSocket.SSLEnabled = false

MailSocket.Messages.Add mail
MailSocket.SendMail
var i as Integer = MailSocket.LastErrorCode

A console app doesn’t have a main event loop to keep the socket around until it’s finished sending. You will need to create a loop that keeps the application running until the email has sent.

Thanks!!!