I have made a console application which check backup file on Ftp and then sends a email
In app.run i have written this code and called the method to Send an email:
Dim objTimer As new CustomTimer objTimer.Mode = Timer.ModeMultiple do App.DoEvents 3000 ProSendEmail(CurrentDate) loop
The method to send email is:
EmailSocket = new MailSocket //Mailsocket is SMTPSecureSocket Dim mail As New EmailMessage EmailSocket.Address = "mail.server" // your SMTP email server EmailSocket.Port =123 EmailSocket.Secure=True EmailSocket.ConnectionType=3 EmailSocket.Username="email@example.com" EmailSocket.Password="123" EmailSocket.Connect While 1=1 EmailSocket.Connect If EmailSocket.IsConnected Then Exit Wend mail.FromAddress = "firstname.lastname@example.org" mail.Subject = "Database backup is missing for Date " mail.AddRecipient("email@example.com") mail.BodyPlainText ="Test email" EmailSocket.DeleteAllMessages EmailSocket.Messages.Append(mail) EmailSocket.SendMail
The mail is not sent. What am I doing wrong in this?
Thanks in advance