Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi,
this is my sendmail code in this i need to display the task id.

when i am saving the data i am converting the taskid to taskname.
projBM.TaskId = Convert.ToInt32(ddlTaskName.SelectedValue);
please check.
in design page i just bind the taskid column as
<asp:Label ID="lblTaskId" runat="server" Text='<%#Eval("TaskID")%>' CssClass="titles2" Visible="false">


private void SendMail()
    {
        try
        {
            
            SmtpClient smtpClient = new SmtpClient();
            MailMessage message = new MailMessage();
            ArrayList empName = null;
            LoginBL loginBL = new LoginBL();
            StringBuilder sb = new StringBuilder();
            empName = loginBL.GetEmployeeName(ddlEmpName.SelectedValue);
            //message.Body = "Please Check Your Task in HRMS";
            message.From = new MailAddress(Session["EmailId"].ToString());
            sb.Append("Hi " + empName[5].ToString());
            sb.AppendLine();
            sb.AppendLine();
            if (hdnEdit.Value != string.Empty)
            {
                //sb.Append("HRMS : " +ddlTaskName.SelectedItem.Text + " is updated");
                message.Subject = "HRMS : " + ddlTaskName.SelectedItem.Text + " is updated";
            }
            else
            {
                //sb.Append("HRMS : " +ddlTaskName.SelectedItem.Text + " is Assigned to You");
                message.Subject = "HRMS : " + ddlTaskName.SelectedItem.Text + " is Assigned to You";

            }
            sb.Append("Please Check Your Task in HRMS");
            sb.AppendLine();
            sb.Append("\n");
            sb.Append("Task Name : " + ddlTaskName.SelectedItem.Text);
            sb.AppendLine();
            sb.Append("\n");
            //sb.Append("Task ID : " +);
            //sb.AppendLine();
            sb.Append("Thanks,");
            sb.AppendLine();
            sb.Append(Session["EmployeeName"].ToString());
            message.Body = sb.ToString();
            message.To.Add(empName[2].ToString());
            smtpClient.Send(message);
        }
please check according to this and help me

Repost
how to retrieve the column from database[^]
Posted
Updated 15-Nov-11 22:51pm
v2
Comments
Sergey Alexandrovich Kryukov 16-Nov-11 3:32am    
We do not check or validate every random piece of code, it makes no sense, especially when you do not explain what do you want to achieve. Please be so kind to ask your questions and explain your problems.
--SA
mandarapu 16-Nov-11 4:35am    
hi,
if you dont know the proper way of helping leave it.i will try some other way.
we are not senior people like you just freshers so we have doubts.this is a forum where we can post our problems.
thatraja 16-Nov-11 4:52am    
Its a repost.
sriman.ch 16-Nov-11 4:03am    
I agree with you SAKryukov...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900