Note that there are some explanatory texts on larger screens.

plurals
  1. POpassing parameters while sending mail
    text
    copied!<p>i got a task to build leave management application in asp.net c#, in leave application when employee fills the required details and press apply button, a mail should deliver to respective manager saying </p> <p>"Hello {Manager},</p> <p>{LoggedInUser}has requested {TypeofLeave} for {NumofDays} kindly login to the portal to accept or reject it</p> <p>Thank You."</p> <p>I am able to get the mail but what i need is in place of {Manager},{TypeoLeave},{NumofDays}, and {LoggedInUser} i need respective name of manager,logged in user and which type o leave the employee has applied and for what number of days. It should extract from database.</p> <p>For eg:"Hello ABC,</p> <p>XYZ has requested Sick Leave for 5 days kindly login to the portal to accept or reject it</p> <p>Thank You."</p> <p>Right now I am getting tsame structure as above. </p> <p>Please help me.</p> <pre><code>protected void BtnApply_Click(object sender, EventArgs e) { MTMSDTO objc = new MTMSDTO(); int Flag = 0; LblLogdInUser.Text = Session["EmpName"].ToString(); objc.LoggedInUser = LblLogdInUser.Text; objc.TypeofLeave = DrpTypeofLeave.SelectedItem.Text; string date; date = Convert.ToDateTime(TxtBeginDate.Text).ToString("dd/MM/yyyy"); DateTime dt = new DateTime(); dt = Convert.ToDateTime(date); objc.BeginDate = dt; objc.EndDate = Convert.ToDateTime(TxtEndDate.Text); objc.Description = TxtDescription.Text; objc.NumofDays = Convert.ToInt32(TxtNumofDays.Text); //objc.EmpName = LblLogdInUser.Text; objc.Status = TxtStatus.Text; int X = obj.InsertLeave(objc); { if (X &gt;= 0) { Flag = 1; } else { Flag = 0; } } if (Flag == 1) { LblSuccess.Visible = true; LblSuccess.Text = "Data Added Successfully and Leave Application Succesfully Sent"; DrpTypeofLeave.ClearSelection(); TxtBeginDate.Text = ""; TxtEndDate.Text = ""; TxtDescription.Text = ""; TxtNumofDays.Text = ""; TxtStatus.Text = ""; } else { LblErr.Visible = true; LblErr.Text = "Failed To Add Data and Send Leave Request!!!"; } objc.EmpName = Convert.ToString(Session["EmpName"]); DataSet GrdLH = obj.GrdLeaveHistory(objc); DataView GrdLeaveH = new DataView(); GrdLeaveH.Table = GrdLH.Tables[0]; GridViewLeaveHistory.DataSource = GrdLeaveH; GridViewLeaveHistory.DataBind(); MailMessage message = new MailMessage(); message.To.Add("abcer@abc.in"); message.Subject = "Leave Request"; message.From = new MailAddress("abc@gmail.com"); message.IsBodyHtml = true; message.Body = "&lt;span style = font-family:Arial,font-size:10pt&gt;"; message.Body += "Hello &lt;b&gt;{Manager}&lt;/b&gt;,&lt;br /&gt;&lt;br /&gt;"; message.Body += "{LoggedInUser}has requested {TypeofLeave} for {NumofDays}"; message.Body += "kindly login to the portal to accept or reject it"; message.Body += "&lt;br /&gt;"; message.Body += "&lt;br /&gt;"; message.Body += "Thank You.&lt;br /&gt;"; message.Body += "&lt;/span&gt;"; SmtpClient smtp = new SmtpClient(""); smtp.Send(message); } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload