0
發送用戶名我在用戶各自的電子郵件地址發送郵件,當他收到的郵件,他看到信息的郵件這樣電子郵件
DOCNAME = ABC 狀態=拒絕
現在我想還可以添加用戶名和希望顯示誰批准他們的文件
我在會議上保存的用戶名,然後當任何用戶登錄,然後在右上角短號他/她的名字可見,並且我在會議上拯救這個名字
Session["Login2"] = txt_username.Value;
01通過他們的帳戶
現在假設主管登錄和批准任何文件及發送郵件那麼當用戶收到的郵件,他將能夠看到郵件這樣
docname= abc
status=reject
username = john
電子郵件代碼
string DocName = ((Label)Repeater2.Items[i].FindControl("DocName")).Text;
string emailId =
((Label)Repeater2.Items[i].FindControl("YourEamil")).Text;
DropDownList dropdownvalue =
((DropDownList)Repeater2.Items[i].FindControl("DropDownList4"));
string docname = String.Empty;
string emailID = String.Empty;
string dropdownvalues = String.Empty;
if (DocName.ToString() != "")
{
docname = DocName.ToString();
}
else
{
docname = "Unavailable";
}
if (emailId.ToString() != "")
{
emailID = emailId.ToString();
}
else
{
emailID = "Unavailable";
}
if (dropdownvalue.SelectedItem.ToString() != "")
{
dropdownvalues = dropdownvalue.SelectedItem.ToString();
}
else
{
dropdownvalues = "Unavailable";
}
SendEmailUsingGmail(DocName, emailId, dropdownvalues);
cmd.ExecuteNonQuery();
}
}
else
{
Supvisor.Text = "Error";
}
if (mySQLconnection.State == ConnectionState.Open)
{
mySQLconnection.Close();
}
}
private void SendEmailUsingGmail(string DocName, string emailId, string
dropdownvalue)
{
try
{
SmtpClient smtp = new SmtpClient();
smtp.Credentials = new NetworkCredential("[email protected]", "123213");
smtp.Port = 587;
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");
message.To.Add(emailId);
//message.To.Add(New MailAddress(toEmailAddress));
message.Subject = "Document Managment System=" + "DropDownList4" + dropdownvalue;
message.Body = "DocName=" + DocName + " DropDownList4=" + dropdownvalue;
smtp.Send(message);
}
catch (Exception ex)
{
Response.Write("Error occured: " + ex.Message.ToString());
}
}
我怎麼做此
我明確電子郵件確定後是正確還是錯誤? – user3044672
對不起,我的壞。沒有注意到D字符的外殼差異。 – Koen