private void btnsubmit_Click(object sender, EventArgs e) { try { //txtfrom.Text = dtpfrom.Value.ToShortDateString(); //txtto.Text = dtpto.Value.ToShortDateString (); int tot=Convert.ToInt16( (dtpto.Value - dtpfrom.Value).TotalDays); MessageBox.Show ("total leave is" + tot.ToString ()); OutlookSession ol = new OutlookSession(); EmailMessage em = new EmailMessage(); Recipient r = new Recipient("Iyalarasi.R", "iyalarasi.r@winxsolutions.com"); em.To.Add(r); em.Subject = "Request For Leave"; em.BodyText =txtename.Text +"("+txteno.Text+ ")" + "request"+ cb1.SelectedItem.ToString()+" leave from "+dtpfrom .Value .ToShortDateString ()+"to"+dtpto .Value.ToShortDateString () + "\n The reason is" + txtreason.Text; EmailAccount ea = ol.EmailAccounts[0]; ea.Send(em); // em.Send("iyalarasi.r");//Account name in outlook //MessagingApplication.Synchronize("iyalarasi.r"); MessageBox.Show("mail sent"); Form2 f2 = new Form2(); f2.Show(); f2.lblmsg.Text = "You have Applied Leave"; } catch (PocketOutlookException ex) { lblmsg1.Text = ex.ToString(); } catch (Exception e1) { lblmsg1.Text = e1.ToString(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)