C# - about Windows.Forms Timer and SMTPClient.SendAsync

212 views Asked by At

I have a Windows.Form Timer that triggers an event every x minutes(5 minutes for example). Basically when that event is triggered, it sends an email out. I used the SMTPClient.SendAsync(); but it does not send the email out successfully. I tried debugging it but there are no errors whatsoever. The code executes fine when I step over that specific line during debug mode.

The SMTPClient.Send(mail); is working however. But I don't want that for my program since it stops the thread until it's finished executing.

This did not happen when I was using System.Timers.Timer. The SendAsync function was working fine before I switched to the Windows.Form Timer. I was able to receive the emails so it can't be the mail settings such as the port,server,credentials, etc.

Is SendAsync not compatible with an event that is triggered by a Windows.Form Timer? Because it was working when I used System.Timers.Timer

0

There are 0 answers