So i have a kinect program which when it detects a
human, it saves images of them and sends your email a notification email, the thing is that when it sends the email, it freezes and stops running, Why does it do this?
Email Notification Code:
void SendNotificationEmail()
{
string email = textBox1.Text;
string message = "Someone has been detected in your house!\n Go to www.kinected.webs.com to view your photos now!!!!";
System.Net.Mail.MailMessage emailsend = new System.Net.Mail.MailMessage();
emailsend.To.Add(email);
emailsend.Subject = "There is an Intruder In Your Home!";
emailsend.From = new System.Net.Mail.MailAddress("
[email protected]");
emailsend.Body = message;
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.mail.yahoo.com.");
smtp.Send(emailsend);
}
When its supposed to fire:
void nui_ColorFrameReady2(object sender, ImageFrameReadyEventArgs e)
{
// 32-bit per pixel, RGBA image xxx
PlanarImage Image = e.ImageFrame.Image;
//int deltaFrames = totalFrames - lastFrameWithMotion;
//if (totalFrames2 <= stopFrameNumber & deltaFrames > 300)
{
++totalFrames2;
string bb1 = Convert.ToString(totalFrames2);
// string file_name_3 = "C:\\Research\\Kinect\\Proposal\\Depth_Img" + bb1 + ".jpg"; xxx
string file_name_4 = "C:\\temp\\Kinect1_Img" + bb1 + ".jpg";
video.Source = BitmapSource.Create(
Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel);
BitmapSource image4 = BitmapSource.Create(
Image.Width, Image.Height, 96, 96, PixelFormats.Bgr32, null, Image.Bits, Image.Width * Image.BytesPerPixel);
if (PersonDetected == 1)
{
if (totalFrames2 % 10 == 0)
{
image4.Save(file_name_4, Coding4Fun.Kinect.Wpf.ImageFormat.Jpeg);
SendNotificationEmail();
PersonDetected = 0;
// lastFrameWithMotion = totalFrames;
// topFrameNumber += 100;
}
}
}
}
Thanks for any help!